firebase - FormatException:意外字符(在字符 1 处) - firebase 身份验证
问题描述
I/flutter ( 4737): FormatException: Unexpected character (at character 1)
I/flutter ( 4737): <!DOCTYPE html>
I/flutter ( 4737): ^
这是我得到的完整错误。这是我发出帖子请求的代码部分。请注意,这CustomExeption
是我自己的错误,我正在我的应用程序的其他部分处理它。
Future<void> signup(String email, String password) async {
final url =
"https://identitytoolkit.googleapis.com/v1/accounts:SignUp?key=[API_KEY]";
try {
final response = await http.post(
url,
body: json.encode(
{
"email": email,
"password": password,
"returnSecureToken": true,
},
),
);
if (json.decode(response.body)['error'] != null) {
throw CustomException(
json.decode(response.body)['error']['message'],
);
}
} catch (error) {
throw error;//Han
}
}
这是触发上述方法的代码部分
Future<void> _saveForm() async {
if (!_form.currentState.validate()) {
return;
}
if (_isSubmitted == false) {
await Provider.of<Auth>(
context,
listen: false,
).signup(
_new_user.getEmail,
_new_user.getPass,
);
setState(() {
_isSubmitted = true;
});
}
}
请让我知道如何进行。在此先感谢!
解决方案
推荐阅读
- postgresql - Hasura Cloud Run 和 Cloud SQL 池设置/数据库错误
- javascript - 如何在地图上突出显示具有更多数据点的区域?
- elasticsearch - Elasticsearch:将点击中的字段和内部点击中的字段相乘
- amazon-web-services - AWS lambda:检查函数是否运行失败
- html - 在 fullcalendar V5.9 中控制 prev 和 next
- ubuntu - 如何在 Ubuntu 上使用数字 debconf-utils - 未知类型
- questdb - Questdb 写权限问题
- android - 从类 FirebaseMessageReceiver 传入 Intent 的对象无法在 Activity 中获取
- amazon-web-services - 如何将aws websocket api网关与.net core applicaiton(websocket服务器)连接
- amazon-web-services - 我可以从 AWS API 网关作为客户端连接到 websocket API