findOne method

Future<T?> findOne(
  1. Object id,
  2. {bool? remote,
  3. bool? background,
  4. Map<String, dynamic>? params,
  5. Map<String, String>? headers,
  6. OnSuccessOne<T>? onSuccess,
  7. OnErrorOne<T>? onError,
  8. DataRequestLabel? label}

Returns model of type T by id.

If _RemoteAdapter.shouldLoadRemoteOne (function of remote) is true, it will initiate an HTTP call. Otherwise returns model of type T and id in local storage.

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

See also: _RemoteAdapter.urlForFindOne, _RemoteAdapter.methodForFindOne.


Future<T?> findOne(
  Object id, {
  bool? remote,
  bool? background,
  Map<String, dynamic>? params,
  Map<String, String>? headers,
  OnSuccessOne<T>? onSuccess,
  OnErrorOne<T>? onError,
  DataRequestLabel? label,
}) {
  return remoteAdapter.findOne(
    remote: remote,
    background: background,
    params: params,
    headers: headers,
    onSuccess: onSuccess,
    onError: onError,
    label: label,