LocalModelAdapter class
A database adapter that stores data on a local terminal.
Use for application development that does not require external storage of values.
For mobile and desktop, data is encrypted and stored in external files, and for the Web, data is encrypted and stored in LocalStorage.
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.
If validator is specified, validation is performed in the database.
ローカル端末にデータを保存するデータベースアダプター。
外部に値を保存する必要のないアプリ開発に利用します。
モバイルやデスクトップは外部ファイルに暗号化してデータが保存されWebの場合はLocalStorageに暗号化されデータが保存されます。
initialValueにデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。
prefixを追加することですべてのパスにプレフィックスを付与することができ、Flavorごとにデータの保存場所を分けるなどの運用が可能です。
validatorを指定するとデータベース内でのバリデーションが行われます。
- Inheritance
-
- Object
- ModelAdapter
- LocalModelAdapter
- Annotations
Constructors
-
LocalModelAdapter({NoSqlDatabase? database, String? prefix, List<
ModelInitialValue> ? initialValue, DatabaseValidator? validator}) -
A database adapter that stores data on a local terminal.
const
Properties
- availableListen → bool
-
no setteroverride
- database → NoSqlDatabase
-
Designated database.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
-
initialValue
→ List<
ModelInitialValue> ? -
Actual data when used as a mock-up.
final
- prefix → String?
-
Path prefix.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- validator → DatabaseValidator?
-
Specify the permission validator for the database.
final
Methods
-
clearAll(
) → Future< void> -
Delete all data in the database.
override
-
clearCache(
) → Future< void> -
If the database is taking a local cache, delete it.
override
-
deleteDocument(
ModelAdapterDocumentQuery query) → Future< void> -
Delete data from the platform set by the adapter by passing
query
.override -
deleteOnBatch(
ModelBatchRef ref, ModelAdapterDocumentQuery query) → void -
Describe the data deletion process when performing a batch.
override
-
deleteOnTransaction(
ModelTransactionRef ref, ModelAdapterDocumentQuery query) → void -
Describe the data deletion process when performing a transaction.
override
-
disposeCollection(
ModelAdapterCollectionQuery query) → void -
The associated collection is discarded by passing
query
.override -
disposeDocument(
ModelAdapterDocumentQuery query) → void -
The destruction of related documents is handled by passing
query
.override -
hasMatch(
{required String path, required String pattern}) → List< String> ? -
Determines if
path
matchespattern
of the formxxxxx/: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.
override
-
loadCollection(
ModelAdapterCollectionQuery query) → Future< Map< String, DynamicMap> > -
Pass
query
to the platform set by the adapter to retrieve the collection.override -
loadDocument(
ModelAdapterDocumentQuery query) → Future< DynamicMap> -
Pass
query
to the platform set by the adapter to retrieve the document.override -
loadOnTransaction(
ModelTransactionRef ref, ModelAdapterDocumentQuery query) → FutureOr< DynamicMap> -
Describe the data acquisition process when performing a transaction.
override
-
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.
override
-
saveDocument(
ModelAdapterDocumentQuery query, DynamicMap value) → Future< void> -
By passing the
query
and thevalue
to be stored, the data is stored on the platform set by the adapter.override -
saveOnBatch(
ModelBatchRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void -
Describe the data storage process when performing a batch.
override
-
saveOnTransaction(
ModelTransactionRef ref, ModelAdapterDocumentQuery query, DynamicMap value) → void -
Describes the data storage process when performing a transaction.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Properties
-
A common database throughout the application.
final