asset property

Future<Map<String, dynamic>> get asset

Implementation

Future<Map<String, dynamic>> get asset async {
  final cached = BaseX.getCacheMethod<Map<String, dynamic>>(path);
  if (cached != null) {
    return Map.unmodifiable(cached);
  }

  // If not cached, load the data
  final rawString = await rootBundle.loadString(path);
  final map = IoExt.auto(path, rawString, (path) => DataX(path));
  BaseX.setCacheMethod(path, map);
  return Map.unmodifiable(map);
}