create method
This function will wrap your incoming data into your app's data. After creating the model will be saved into the desired collection.
Implementation
Future<M?> create(Map<String, dynamic> data) async {
M? model = await onCreate(data);
if (model == null) {
return null;
}
if ((await model.save()) == null) {
return null;
}
return model;
}