save method

Future<T> save({
  1. bool? remote,
  2. Map<String, dynamic>? params,
  3. Map<String, String>? headers,
  4. OnData<T>? onSuccess,
  5. OnDataError<T>? onError,
})

Saves this model through a call equivalent to Repository.save.

Usage: await post.save(), author.save(remote: false, params: {'a': 'x'}).

Requires this model to be initialized.

Implementation

Future<T> save({
  bool? remote,
  Map<String, dynamic>? params,
  Map<String, String>? headers,
  OnData<T>? onSuccess,
  OnDataError<T>? onError,
}) async {
  _assertInit('save');
  return await remoteAdapter.save(
    this as T,
    remote: remote,
    params: params,
    headers: headers,
    onSuccess: onSuccess,
    onError: onError,
  );
}