ApiCollectionModel<T> constructor
ApiCollectionModel<T> (})
Class that can retrieve data from the RestAPI and store it as a collection of value.
Basically, you get a List of Map or a Map of Map as a response of RestAPI and use it by converting it. The data is converted using fromCollection and toCollection.
Use get
in the load() method and post
in the save() method as HTTP methods.
Implementation
ApiCollectionModel(
this.endpoint, {
this.headers = const {},
List<T>? initialValue,
}) : super(initialValue ?? []);