updateMobile method
Implementation
Future<User> updateMobile(String? mobile) async {
//
var body = json.encode({"mobile": mobile, "client": client});
//
// final initUrl = '$baseUrl/api/user/mobile';
final initUrl = BytedeskUtils.getHostUri('/api/user/mobile');
final initResponse =
await httpClient.post(initUrl, headers: getHeaders(), body: body);
//解决json解析中的乱码问题
Utf8Decoder utf8decoder = const Utf8Decoder(); // fix 中文乱码
//将string类型数据 转换为json类型的数据
final responseJson =
json.decode(utf8decoder.convert(initResponse.bodyBytes));
// debugPrint("updateMobile $responseJson");
// 更新本地数据
SpUtil.putString(BytedeskConstants.mobile, mobile!);
return User.fromJson(responseJson['data']);
}