loadOnce method

  1. @override
Future<ApiCollectionModel<T>> loadOnce()
override

If the data is empty, load is performed only once.

In other cases, the value is returned as is.

Use isEmpty to determine whether the file is empty or not.

Implementation

@override
Future<ApiCollectionModel<T>> loadOnce() async {
  if (!loaded) {
    loaded = true;
    return load();
  }
  return this;
}