UserInfoUpdateRequest constructor Null safety

UserInfoUpdateRequest(
  1. {String? userId,
  2. String? nickname,
  3. FileInfo? fileInfo,
  4. List<String>? discoveryKeys,
  5. List<String>? preferredLanguages,
  6. OnUploadProgressCallback? onProgress}
)

Implementation

UserInfoUpdateRequest({
  String? userId,
  String? nickname,
  FileInfo? fileInfo,
  List<String>? discoveryKeys,
  List<String>? preferredLanguages,
  OnUploadProgressCallback? onProgress,
}) : super(userId: userId) {
  isMultipart = fileInfo?.file != null;
  url = 'users/${userId ?? state.userId}';
  body = {
    'nickname': nickname,
    if (fileInfo != null) 'profile_file': fileInfo,
    if (fileInfo?.url != null) 'profile_url': fileInfo?.url,
    'discovery_keys': discoveryKeys,
    'preferred_languages': preferredLanguages,
  };
  body.removeWhere((key, value) => value == null);
}