save<T extends Model> method

  1. @override
Future<void> save<T extends Model>(
  1. T model, {
  2. QueryPredicate<Model>? where,
})
override

Implementation

@override
Future<void> save<T extends Model>(T model, {QueryPredicate? where}) async {
  try {
    await _setUpObserveIfNeeded();
    var methodChannelSaveInput = <String, dynamic>{
      'modelName': model.getInstanceType().modelName(),
      if (where != null) 'queryPredicate': where.serializeAsMap(),
      'serializedModel': model.toJson(),
    };
    await _channel.invokeMethod('save', methodChannelSaveInput);
  } on PlatformException catch (e) {
    throw _deserializeException(e);
  }
}