findOne method
- Object id,
- {bool? remote,
- bool? background,
- Map<
String, dynamic> ? params, - Map<
String, String> ? headers, - OnSuccessOne<
T> ? onSuccess, - OnErrorOne<
T> ? onError, - 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
.
Implementation
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(
id,
remote: remote,
background: background,
params: params,
headers: headers,
onSuccess: onSuccess,
onError: onError,
label: label,
);
}