deploySchema function
Future<void>
deploySchema({
- required RoomClient room,
- required MeshSchema schema,
- required String name,
- bool overwrite = true,
Deploy schema to the room’s storage.
Implementation
Future<void> deploySchema({required RoomClient room, required MeshSchema schema, required String name, bool overwrite = true}) async {
_validateSchemaName(name);
final handle = await room.storage.open('.schemas/$name.json', overwrite: overwrite);
// Convert schema to JSON, then to bytes.
final data = utf8.encode(jsonEncode(schema.toJson()));
await room.storage.write(handle, data);
await room.storage.close(handle);
}