manifestParser static method Null safety

  1. @visibleForTesting
Future<Map<String, List<String>>?> manifestParser(
  1. String? jsonData

Parses the asset manifest string into a strongly-typed map.


static Future<Map<String, List<String>>?> manifestParser(String? jsonData) {
  if (jsonData == null) {
    return SynchronousFuture<Map<String, List<String>>?>(null);
  // TODO(ianh): JSON decoding really shouldn't be on the main thread.
  final Map<String, dynamic> parsedJson = json.decode(jsonData) as Map<String, dynamic>;
  final Iterable<String> keys = parsedJson.keys;
  final Map<String, List<String>> parsedManifest = <String, List<String>> {
    for (final String key in keys) key: List<String>.from(parsedJson[key] as List<dynamic>),
  // TODO(ianh): convert that data structure to the right types.
  return SynchronousFuture<Map<String, List<String>>?>(parsedManifest);