getInitialDocument method
Load the document corresponding to query
from _registeredInitialValue
.
If data is found, it is returned in DynamicMap
.
If no data is found or the path is invalid, Null is returned.
prefix
can be specified to prefix the path.
_registeredInitialValue
からquery
に対応するドキュメントを読み込みます。
データが見つかった場合はDynamicMap
で返されます。
データが見つからなかったり、パスに不正があった場合はNullが返されます。
prefix
を指定するとパスにプレフィックスを付与可能です。
Implementation
Future<DynamicMap?> getInitialDocument(
ModelAdapterDocumentQuery query, {
String? prefix,
}) async {
_addDocumentListener(query, prefix: prefix);
await _initialize();
await onLoad?.call(this);
final trimPath = _path(query.query.path, prefix);
if (_registeredInitialValue.containsKey(trimPath)) {
return Map<String, dynamic>.from(_registeredInitialValue[trimPath] ?? {});
}
return null;
}