2021年3月28日星期日

http.post problem after Flutter 2 upgrade

I have just updated to Flutter 2. I updated all the dependencies including http. Now I have a problem with the following:

Future<UserLogin> fetchStaff(String pUserName, String pPassword) async {    final response = await http        .post(Uri.encodeFull('$kBaseUrl/LoginService/CheckLogin'),            headers: {'Content-Type': 'application/json', 'Accept': 'application/json'},            body: '{ "pUser": "$pUserName", "pPassword": "$pPassword"}')        .timeout(Duration(seconds: kTimeOutDuration));  

I'm getting an error on the: Uri.encodeFull('$kBaseUrl/LoginService/CheckLogin'

"The argument type 'String' can't be assigned to the parameter type 'Uri'."

$kBaseUrl = 'https://subdom.mydomain.com:443/mobile';

What do I need to change?

https://stackoverflow.com/questions/66848615/http-post-problem-after-flutter-2-upgrade March 29, 2021 at 12:03PM

没有评论:

发表评论