ListenableFirestoreModelAdapter class

Model adapter with Firebase Firestore available.

It monitors all documents in Firestore for changes and notifies you of any changes on the remote side.

Firestore application settings must be completed in advance and FirebaseCore.initialize must be executed.

Basically, the default FirebaseFirestore.instance is used, but it is possible to use a specified database by passing database when creating the adapter.

You can initialize Firebase by passing options.

The internal database can be specified in localDatabase.

By passing data to initialValue, the database can be used as a data mockup because it contains data in advance.

By adding prefix, all paths can be prefixed, enabling operations such as separating data storage locations for each Flavor.

FirebaseFirestoreを利用できるようにしたモデルアダプター。

Firestoreのすべてのドキュメントの変更を監視し、リモート側で変更があればそれを通知します。

事前にFirestoreのアプリ設定を済ませておくこととFirebaseCore.initializeを実行しておきます。

基本的にデフォルトのFirebaseFirestore.instanceが利用されますが、アダプターの作成時にdatabaseを渡すことで指定されたデータベースを利用することが可能です。

optionsを渡すことでFirebaseの初期化を行うことができます。

内部データベースはlocalDatabaseで指定することができます。

initialValueにデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。

prefixを追加することですべてのパスにプレフィックスを付与することができ、Flavorごとにデータの保存場所を分けるなどの運用が可能です。

Inheritance
Implemented types

Constructors

ListenableFirestoreModelAdapter({List<ModelInitialValue>? initialValue, FirebaseFirestore? database, NoSqlDatabase? localDatabase, FirebaseOptions? options, FirebaseOptions? iosOptions, FirebaseOptions? androidOptions, FirebaseOptions? webOptions, FirebaseOptions? linuxOptions, FirebaseOptions? windowsOptions, FirebaseOptions? macosOptions, String? prefix, DatabaseValidator? validator, Future<void> onInitialize(FirebaseOptions? options)?})
Model adapter with Firebase Firestore available.
const

Properties

androidOptions FirebaseOptions?
Options for initializing Firebase.
finalinherited
availableListen bool
no setteroverride
database → FirebaseFirestore
The Firestore database instance used in the adapter.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
initialValue List<ModelInitialValue>?
Actual data when used as a mock-up.
finalinherited
iosOptions FirebaseOptions?
Options for initializing Firebase.
finalinherited
linuxOptions FirebaseOptions?
Options for initializing Firebase.
finalinherited
localDatabase NoSqlDatabase
Caches data retrieved from the specified internal database, Firestore.
no setterinherited
macosOptions FirebaseOptions?
Options for initializing Firebase.
finalinherited
onInitialize → (Future<void> Function(FirebaseOptions? options)?)
Callback for initialization. If this is specified, normal initialization is not performed.
finalinherited
options FirebaseOptions?
Options for initializing Firebase.
no setterinherited
prefix String?
Path prefix.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
validator DatabaseValidator?
Specify the permission validator for the database.
finalinherited
webOptions FirebaseOptions?
Options for initializing Firebase.
finalinherited
windowsOptions FirebaseOptions?
Options for initializing Firebase.
finalinherited

Methods

clearAll() Future<void>
Delete all data in the database.
inherited
clearCache() Future<void>
If the database is taking a local cache, delete it.
inherited
deleteDocument(ModelAdapterDocumentQuery query) Future<void>
Delete data from the platform set by the adapter by passing query.
inherited
deleteOnBatch(ModelBatchRef ref, ModelAdapterDocumentQuery query) → void
Describe the data deletion process when performing a batch.
inherited
deleteOnTransaction(ModelTransactionRef ref, ModelAdapterDocumentQuery query) → void
Describe the data deletion process when performing a transaction.
inherited
disposeCollection(ModelAdapterCollectionQuery query) → void
The associated collection is discarded by passing query.
inherited
disposeDocument(ModelAdapterDocumentQuery query) → void
The destruction of related documents is handled by passing query.
inherited
hasMatch({required String path, required String pattern}) List<String>?
Determines if path matches pattern of the form xxxxx/:id/yyyy.
inherited
listenCollection(ModelAdapterCollectionQuery query) Future<List<StreamSubscription>>
Pass query to monitor the collection.
override
listenDocument(ModelAdapterDocumentQuery query) Future<List<StreamSubscription>>
Pass query to monitor the document.
override
loadAggregation<T>(ModelAdapterCollectionQuery query, ModelAggregateQuery<AsyncAggregateValue> aggregateQuery) Future<T?>
Aggregate queries against data collections to retrieve data.
inherited
loadCollection(ModelAdapterCollectionQuery query) Future<Map<String, DynamicMap>>
Pass query to the platform set by the adapter to retrieve the collection.
inherited
loadDocument(ModelAdapterDocumentQuery query) Future<DynamicMap>
Pass query to the platform set by the adapter to retrieve the document.
inherited
loadOnTransaction(ModelTransactionRef ref, ModelAdapterDocumentQuery query) FutureOr<DynamicMap>
Describe the data acquisition process when performing a transaction.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runBatch(FutureOr<void> batch(ModelBatchRef ref), int splitLength) FutureOr<void>
Processes a batch for execution.
override
runTransaction(FutureOr<void> transaction(ModelTransactionRef ref)) FutureOr<void>
Do the processing to execute the transaction.
inherited
saveDocument(ModelAdapterDocumentQuery query, DynamicMap value) Future<void>
By passing the query and the value to be stored, the data is stored on the platform set by the adapter.
inherited
saveOnBatch(ModelBatchRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void
Describe the data storage process when performing a batch.
inherited
saveOnTransaction(ModelTransactionRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void
Describes the data storage process when performing a transaction.
inherited
toString() String
A string representation of this object.
inherited

Operators

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