DocumentBase<T>.unrestricted constructor

DocumentBase<T>.unrestricted(
  1. DocumentModelQuery modelQuery, [
  2. T? _value
])

Define a document model for storing T types that inherit from ChangeNotifier.

Any changes made locally in the app will be notified and related objects will reflect the changes.

When a value is reflected by save, delete, transaction, or updated in real time from outside, all listeners are notified of the change by notifyListeners.

Define object conversion from DynamicMap to T, which is output by decoding Json by implementing DocumentBase.fromMap.

Implementing DocumentBase.toMap defines the conversion from a T object to a DynamicMap that can later be Json encoded.

By defining DocumentBase.modelQuery, you can specify settings for loading, such as document paths.

The value value can be set and retrieved. In this case, no change notification is made as in the case of ValueNotifier.

ChangeNotifierを継承したT型を保存するためのドキュメントモデルを定義します。

アプリのローカル内での変更はすべて通知され関連のあるオブジェクトは変更内容が反映されます。

savedeletetransactionでの値反映、外部からのリアルタイム更新が行われた場合notifyListenersによって変更内容がすべてのリスナーに通知されます。

DocumentBase.fromMapを実装することでJsonをデコードして出力されるDynamicMapからTへのオブジェクト変換を定義します。

DocumentBase.toMapを実装することでTのオブジェクトから後にJsonエンコード可能なDynamicMapへの変換を定義します。

DocumentBase.modelQueryを定義することで、ドキュメントのパスなど読み込みを行うための設定を指定できます。

value値をセット、取得できます。その際ValueNotifierのように変更通知は行われません。

Implementation

DocumentBase.unrestricted(this.modelQuery, [this._value]);