init static method

Future init()

Implementation

static Future init() async {
  // 加载asset相关信息, 供区分图片分辨率用, 因为native端的加载asset方法无法区分分辨率, 这是一个变通方法
  assetManifest =
  await rootBundle.loadStructuredData<Map<String, List<String>>>(
    'AssetManifest.json',
        (String jsonData) {
      if (jsonData == null)
        return SynchronousFuture<Map<String, List<String>>>(null);

      final Map<String, dynamic> parsedJson = json.decode(jsonData);
      final Iterable<String> keys = parsedJson.keys;
      final Map parsedManifest = Map<String, List<String>>.fromIterables(
        keys,
        keys.map<List<String>>((key) => List<String>.from(parsedJson[key])),
      );
      return SynchronousFuture<Map<String, List<String>>>(parsedManifest);
    },
  );
}