loadRequest method

  1. @override
  2. @protected
Future<void> loadRequest()
override

The actual loading process is done from the API when it is loaded.

By overriding, it is possible to use plugins, etc. in addition to simply retrieving from the URL.

Implementation

@override
@protected
Future<void> loadRequest() async {
  final cache = Prefs.getString(endpoint);
  if (cache.isNotEmpty) {
    final data =
        fromCollection(filterOnLoad(jsonDecodeAsList<DynamicMap>(cache)));
    addAll(data);
    _loadProcess(false);
  } else {
    final posts = await _loadProcess();
    final data = fromCollection(filterOnLoad(posts));
    addAll(data);
  }
}