Subject.fromJson constructor

Subject.fromJson(
  1. Map<String, dynamic> json
)

Creates a Subject from JSON data.

Implementation

factory Subject.fromJson(Map<String, dynamic> json) {
  final tempGroupJson = json['group'];
  final tempKindJson = json['kind'];
  final tempServiceAccountJson = json['serviceAccount'];
  final tempUserJson = json['user'];

  final GroupSubject? tempGroup =
      tempGroupJson != null ? GroupSubject.fromJson(tempGroupJson) : null;
  final String tempKind = tempKindJson;
  final ServiceAccountSubject? tempServiceAccount =
      tempServiceAccountJson != null
          ? ServiceAccountSubject.fromJson(tempServiceAccountJson)
          : null;
  final UserSubject? tempUser =
      tempUserJson != null ? UserSubject.fromJson(tempUserJson) : null;

  return Subject(
    group: tempGroup,
    kind: tempKind,
    serviceAccount: tempServiceAccount,
    user: tempUser,
  );
}