save method

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

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,
  OnSuccessOne<T>? onSuccess,
  OnErrorOne<T>? onError,
  DataRequestLabel? label,
}) {
  return remoteAdapter.save(
    model,
    remote: remote,
    params: params,
    headers: headers,
    onSuccess: onSuccess,
    onError: onError,
    label: label,
  );
}