parseProcesses method Null safety

Map<String, String> parseProcesses(
  1. Json json
)

Generates processes from the json data

Implementation

static Map<String, String> parseProcesses(Json json) {
  final processes = Map.from(json['processes'])
      .map((key, value) => MapEntry(key, value['component'].split('/').last))
      .cast<String, String>();

  // Overwrite process name with that given for custom component
  final connections = List.from(json['connections']);

  for (final connection in connections.toList()) {
    var targetProcess = connection['tgt']['process'];
    if (targetProcess.contains('custom') && connection['data'] != null) {
      processes[targetProcess] = connection['data'];
      // remove connection to set name of custom process
      connections.remove(connection);
    }
  }
  json['connections'] = connections;

  return processes;
}