FirebaseDatabaseAdapter<T extends DataModel<T>> mixin

A RemoteAdapter you can use to add the firebase realtime database as backend for a repository.

This class provides all the internal logic enabling you to use a standard flutter_data repository to connect with a firebase realtime database and use it as remote storage backend for your local data. It also provides some extra functionality, mainly streaming remote changes and remote transactions.

Superclass Constraints
  • RemoteAdapter<T>

Properties

adapters Map<String, RemoteAdapter<DataModelMixin>>
All adapters for the relationship subgraph of T and their relationships.
no setterinherited
baseUrl String
Returns the base URL for this type T.
no setterinherited
defaultHeaders FutureOr<Map<String, String>>
A Map representing default HTTP headers.
no setterinherited
defaultParams FutureOr<Map<String, dynamic>>
A Map representing default HTTP query parameters. Defaults to empty.
no setter
defaultQueryFilter Filter?
The default query filter to be added to all GET-requests.
no setter
defaultRequestConfig RequestConfig?
The default RequestConfig added to all requests.
no setter
graph → GraphNotifier
A GraphNotifier instance also available to adapters
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
httpClient → Client
An http.Client used to make an HTTP request.
no setterinherited
idToken String?
The current idToken of the account you want to use.
no setter
internalType String
INTERNAL: DO NOT USE
no setterinherited
internalWatch ↔ Watcher?
ONLY FOR FLUTTER DATA INTERNAL USE
getter/setter pairinherited
isInitialized bool
no setterinherited
localAdapter → LocalAdapter<T>
finalinherited
offlineOperations Set<OfflineOperation<T>>
no setterinherited
ref → Ref<Object?>
Give access to the dependency injection system
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String
The pluralized and downcased DataHelpers.getType<T> version of type T by default.
no setterinherited

Methods

clear() Future<void>
inherited
delete(Object model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnSuccessOne<T>? onSuccess, OnErrorOne<T>? onError, DataRequestLabel? label}) Future<T?>
inherited
deleteLocal(T model, {bool notify = true}) → void
inherited
deserialize(Object? data) Future<DeserializedData<T>>
Returns a DeserializedData object when deserializing a given data.
inherited
dispose() → void
inherited
findAll({bool? remote, bool? background, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, OnSuccessAll<T>? onSuccess, OnErrorAll<T>? onError, DataRequestLabel? label}) Future<List<T>>
inherited
findOne(Object id, {bool? remote, bool? background, Map<String, dynamic>? params, Map<String, String>? headers, OnSuccessOne<T>? onSuccess, OnErrorOne<T>? onError, DataRequestLabel? label}) Future<T?>
inherited
initialize({bool? remote, required Map<String, RemoteAdapter<DataModelMixin>> adapters, required Ref<Object?> ref}) Future<RemoteAdapter<T>>
inherited
isOfflineError(Object? error) bool
Determines whether error was an offline error.
inherited
keyForModelOrId(Object model) String
inherited
log(DataRequestLabel label, String message, {int logLevel = 1}) → void
inherited
methodForDelete(dynamic id, Map<String, dynamic> params) → DataRequestMethod
Returns HTTP method for delete. Defaults to DELETE.
inherited
methodForFindAll(Map<String, dynamic> params) → DataRequestMethod
Returns HTTP method for findAll. Defaults to GET.
inherited
methodForFindOne(dynamic id, Map<String, dynamic> params) → DataRequestMethod
Returns HTTP method for findOne. Defaults to GET.
inherited
methodForSave(dynamic id, Map<String, dynamic> params) → DataRequestMethod
Returns HTTP method for save. Defaults to PATCH if id is present, or POST otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onError<R>(DataException e, DataRequestLabel? label) FutureOr<R?>
Implements global request error handling.
inherited
onInitialized() Future<void>
inherited
onModelInitialized(T model) → void
After model initialization hook
inherited
onSuccess<R>(DataResponse response, DataRequestLabel label) FutureOr<R?>
inherited
save(T model, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, OnSuccessOne<T>? onSuccess, OnErrorOne<T>? onError, DataRequestLabel? label}) Future<T>
inherited
saveLocal(T model, {bool notify = true}) → T
inherited
sendRequest<R>(Uri uri, {DataRequestMethod method = DataRequestMethod.GET, Map<String, String>? headers, bool omitDefaultParams = false, dynamic requestType = DataRequestType.adhoc, String? key, String? body, dynamic onSuccess, dynamic onError}) FutureOr<R?>
The function used to perform an HTTP request and return an R.
serialize(T model, {bool withRelationships = true}) Future<Map<String, dynamic>>
Returns a serialized version of a model of T, as a Map<String, dynamic> ready to be JSON-encoded.
inherited
shouldLoadRemoteAll(bool remote, Map<String, dynamic> params, Map<String, String> headers) bool
Returns whether calling findAll should trigger a remote call.
inherited
shouldLoadRemoteOne(Object? id, bool remote, Map<String, dynamic> params, Map<String, String> headers) bool
Returns whether calling findOne should initiate an HTTP call.
inherited
streamAll({Map<String, dynamic>? params, Map<String, String>? headers, bool syncLocal = false, bool autoRenew = true, UnsupportedEventCb? onUnsupportedEvent}) Stream<List<T>>
Creates a stream to the remote server to receive continuous updates about all changes to the repository.
streamOne(String id, {Map<String, dynamic>? params, Map<String, String>? headers, bool autoRenew = true, UnsupportedEventCb? onUnsupportedEvent}) Stream<T?>
Creates a stream to the remote server to receive continuous updates about all changes on the data model identified by id.
toString() String
A string representation of this object.
inherited
transaction(String id, TransactionFn<T> transaction, {Map<String, dynamic>? params, Map<String, String>? headers, dynamic onBeginSuccess, dynamic onBeginError, dynamic onCommitSuccess, dynamic onCommitError}) Future<T?>
Executes a remote transaction on the given id.
urlForDelete(dynamic id, Map<String, dynamic> params) String
Returns URL for delete. Defaults to type/id.
urlForFindAll(Map<String, dynamic> params) String
Returns URL for findAll. Defaults to type.
urlForFindOne(dynamic id, Map<String, dynamic> params) String
Returns URL for findOne. Defaults to type/id.
urlForSave(dynamic id, Map<String, dynamic> params) String
Returns URL for save. Defaults to type/id (if id is present).
watchAllNotifier({bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, bool? syncLocal, String? finder, DataRequestLabel? label}) → DataStateNotifier<List<T>>
inherited
watchOneNotifier(String key, {bool? remote, Map<String, dynamic>? params, Map<String, String>? headers, AlsoWatch<T>? alsoWatch, String? finder, DataRequestLabel? label}) → DataStateNotifier<T?>
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited