createSchema method Null safety
- String label,
- Map<
String, SchemaKind> fields, - Map<
String, String> ? metadata, - [ResponseCallback<
CreateSchemaResponse> ? callback]
createSchema
creates a schema
Args:
label (String): The label of the schema to create.
fields (Map<String, SchemaKind>): A map of field names to their schema kind.
metadata (Map<String, String>): A map of metadata to be associated with the schema.
callback (ResponseCallback
Implementation
Future<CreateSchemaResponse?> createSchema(String label, Map<String, SchemaKind> fields, Map<String, String>? metadata,
[ResponseCallback<CreateSchemaResponse>? callback]) async {
final resp = await MotorFlutterPlatform.instance.createSchema(CreateSchemaRequest(
label: label,
fields: fields,
metadata: metadata,
));
if (callback != null) {
callback(resp);
}
if (resp != null) {
schemaHistory.add(resp.schemaDefinition);
}
return resp;
}