setSelfInfo method

Future<void> setSelfInfo({
  1. String? avatar,
  2. String? nickname,
  3. int? gender,
  4. String? motto,
  5. String? birthday,
})

Implementation

Future<void> setSelfInfo({
  String? avatar,
  String? nickname,
  int? gender,
  String? motto,
  String? birthday,
}) async {
  await _net.http.post('/api/v1/user/detail-update', data: {
    'avatar': ?avatar,
    'nickname': ?nickname,
    'gender': ?gender,
    'motto': ?motto,
    'birthday': ?birthday,
  });
  if (_self != null) {
    _self = _self!.copyWith(
      avatar: avatar,
      nickname: nickname,
      gender: gender,
      motto: motto,
      birthday: birthday,
    );
    await _store.setKv(
      LocalStorage.keyUserInfo,
      encodeJsonString(_self!.toJson()),
    );
    _listener?.selfInfoUpdated(_self!);
  }
}