updateCurrentUserInfo method Null safety

Future<void> updateCurrentUserInfo(
  1. {String? nickname,
  2. FileInfo? fileInfo,
  3. List<String>? preferredLanguages,
  4. OnUploadProgressCallback? progress}
)

Updates current user information with nickname, fileInfo, preferredLanguages.

Implementation

Future<void> updateCurrentUserInfo({
  String? nickname,
  FileInfo? fileInfo,
  List<String>? preferredLanguages,
  OnUploadProgressCallback? progress,
}) async {
  if (nickname == null && fileInfo == null && preferredLanguages == null) {
    throw InvalidParameterError();
  }

  final user = await _int.api.send<User>(UserInfoUpdateRequest(
    // userId: _int.state.userId ?? '',
    nickname: nickname,
    fileInfo: fileInfo,
    preferredLanguages: preferredLanguages,
    onProgress: progress,
  ));
  _int.state.currentUser?.copyWith(user);
}