I have a project whereby I am using the http package to make various http requests. I recently updated the package and I cannot append url links to the end of the base url that I have. Here is the sample code
var _url = Uri.parse('url here');
var token;
_getToken() async {
SharedPreferences localStorage = await SharedPreferences.getInstance();
token = jsonDecode(localStorage.getString('token'))['token'];
}
authData(data, apiUrl) async {
try {
var fullUrl = _url + apiUrl;
return await http.post(fullUrl,
body: jsonEncode(data), headers: _setHeaders());
} catch (e) {
print(e);
}
}
This is the error it displays
The operator '+' isn't defined for the type 'Uri'.
Try defining the operator '+'.dartundefined_operator
The error occurs at var fullUrl = _url + apiUrl; specifically the + operator. Before updating it worked well however I cannot find the solution to it