save method

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

Saves model of type T.

If remote is true, it will initiate an HTTP call.

Always persists to local storage.

Arguments params and headers will be merged with _RemoteAdapter.defaultParams and _RemoteAdapter.defaultHeaders, respectively.

See also: _RemoteAdapter.urlForSave, _RemoteAdapter.methodForSave.

Implementation

Future<T> save(
  T model, {
  bool? remote,
  Map<String, dynamic>? params,
  Map<String, String>? headers,
  OnData<T>? onSuccess,
  OnDataError<T>? onError,
}) {
  return remoteAdapter.save(
    model,
    remote: remote,
    params: params,
    headers: headers,
    onSuccess: onSuccess,
    onError: onError,
  );
}