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);
// Convert schema to JSON, then to bytes.
final data = Uint8List.fromList(utf8.encode(jsonEncode(schema.toJson())));
await room.storage.uploadStream('.schemas/$name.json', Stream.value(data), overwrite: overwrite, size: data.length);
}