Serverpod makes it easy to generate serializable classes that can be passed between server and client or used to communicate with the database. The structure for the classes is defined in yaml-files in the
protocol directory. Run
serverpod generate to build the Dart code for the classes and make them accessible to both the server and client.
Here is a simple example of a yaml-file defining a serializable class:
Supported types are
ByteData, and other serializable classes. You can also use
Maps of the supported types. Null safety is supported. The keys of
Map must be non-nullable
Strings Once your classes are generated, you can use them as parameters or return types to endpoint methods.