deploySchema function

Future<void> deploySchema({
  1. required RoomClient room,
  2. required MeshSchema schema,
  3. required String name,
  4. 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);
}