Policy.fromJson constructor

Policy.fromJson(
  1. Object? j
)

Implementation

factory Policy.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Policy(
    version: switch (json['version']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    bindings: switch (json['bindings']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Binding.fromJson(i)],
      _ => throw const FormatException('"bindings" is not a list'),
    },
    auditConfigs: switch (json['auditConfigs']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) AuditConfig.fromJson(i)],
      _ => throw const FormatException('"auditConfigs" is not a list'),
    },
    etag: switch (json['etag']) {
      null => Uint8List(0),
      Object $1 => decodeBytes($1),
    },
  );
}