Usage.fromJson constructor

Usage.fromJson(
  1. Object? j
)

Implementation

factory Usage.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Usage(
    requirements: switch (json['requirements']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"requirements" is not a list'),
    },
    rules: switch (json['rules']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) UsageRule.fromJson(i)],
      _ => throw const FormatException('"rules" is not a list'),
    },
    producerNotificationChannel:
        switch (json['producerNotificationChannel']) {
          null => '',
          Object $1 => decodeString($1),
        },
  );
}