SharedProfile.fromJson constructor

SharedProfile.fromJson({
  1. required String userId,
  2. required bool isActive,
  3. required Map<String, Object?> json,
})

Implementation

factory SharedProfile.fromJson({required String userId, required bool isActive, required Map<String, Object?> json}) {
  final rawProfile = json["profile"];
  final rawSession = json["session"];
  final rawProject = json["project"];
  return SharedProfile(
    userId: userId,
    isActive: isActive,
    profile: rawProfile is Map ? SharedProfileInfo.fromJson(_objectMap(rawProfile)) : null,
    apiUrl: _normalizeApiUrl(_nullableString(json["api_url"])),
    session: rawSession is Map ? SharedProfileSession.fromJson(_objectMap(rawSession)) : null,
    activeProject: rawProject is Map ? _nullableString(rawProject["active_project"]) : null,
  );
}