CockpitLocatorResolution.fromJson constructor

CockpitLocatorResolution.fromJson(
  1. Map<String, Object?> json, {
  2. String path = r'$',
})

Decodes a CockpitLocatorResolution from a JSON object.

Implementation

factory CockpitLocatorResolution.fromJson(
  Map<String, Object?> json, {
  String path = r'$',
}) {
  final matchedSignalsJson = json['matchedSignals'] as Map<Object?, Object?>?;
  return CockpitLocatorResolution(
    matchedKind: CockpitLocatorKind.fromJson(
      json['matchedKind'],
      path: '$path.matchedKind',
    ),
    matchedValue: json['matchedValue']! as String,
    matchedSignals: matchedSignalsJson == null
        ? const <String, String>{}
        : Map<String, String>.from(
            matchedSignalsJson.map(
              (key, value) => MapEntry('$key', '$value'),
            ),
          ),
  );
}