FirebaseStore<T>.apiCreate constructor
FirebaseStore<T>.apiCreate ({
- required RestApi restApi,
- required List<
String> subPaths, - required DataFromJsonCallback<
T> onDataFromJson, - required DataToJsonCallback<
T> onDataToJson, - required PatchDataCallback<
T> onPatchData,
Constructs a store from a restApi
and a list of subPaths
with
callbacks.
This is a direct constructor, without utilizing a parent store. However, it requires you to get access to a RestApi first.
The callbacks are used to perform the serialization from and to JSON.
onDataFromJson
is used to convert a json value to T
, onDataToJson
does the other way around. onPatchData
is used to process patch updates
from the server and update instances of T
.
Note: Typically, you would use a FirebaseDatabase to create a "root" store instead of using this constructor.
Implementation
factory FirebaseStore.apiCreate({
required RestApi restApi,
required List<String> subPaths,
required DataFromJsonCallback<T> onDataFromJson,
required DataToJsonCallback<T> onDataToJson,
required PatchDataCallback<T> onPatchData,
}) = CallbackFirebaseStore.api;