Event.fromJson constructor

Event.fromJson(
  1. Object? j
)

Implementation

factory Event.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Event(
    artifact: switch (json['artifact']) {
      null => '',
      Object $1 => decodeString($1),
    },
    execution: switch (json['execution']) {
      null => '',
      Object $1 => decodeString($1),
    },
    eventTime: switch (json['eventTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    type: switch (json['type']) {
      null => Event_Type.$default,
      Object $1 => Event_Type.fromJson($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
  );
}