toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  List<Map<String, dynamic>> rolesJs = [];
  if (roles != null) {
    for (Role role in roles!) {
      rolesJs.add(role.toJson());
    }
  }

  return {
    "id": id.toString(),
    "name": name,
    if (roles != null) "roles": rolesJs,
    if (user != null) "user": user!.toJson(),
    if (requireColons != null) "require_colons": requireColons,
    if (managed != null) "managed": managed,
    if (animated != null) "animated": animated,
    if (available != null) "available": available
  };
}