build method

  1. @override
List<Map<String, dynamic>> build(
  1. String apiKey,
  2. String path
)

Implementation

@override
List<Map<String, dynamic>> build(String apiKey, String path) {
  log.fine('HttpDataState recreated $apiKey$path');
  if (!ref.watch(hiveBox(hiveName)).hasValue) {
    throw StateError('hive box is not inited: $hiveName');
  }
  final hive = future();

  // return ref.watch(hiveBox(hiveName)).when(
  //     data: (hive) {
  updateIfOld();
  final hiveKey = apiKey + path;
  final data = jsonDecode(hive.get(hiveKey) as String? ?? '[]') as List;
  return data.whereType<Map<String, dynamic>>().toList();
  //       },
  //       error: (o, e) => [],
  //       loading: () => []);
}