In Flutter I am building a web app. In this I would need a function where I can get data from the URL, in the same way that you would get it in Javascript. How would I do this?
Say I, for example, append the following to my URL when I load my web app: /#/5a9c14ca-06bf-4c3d-b41e-a1317ea1ae79.
How can I get them in Dart either as a raw string (preferred) or in some other format?
What I Have tried so far
void initState() {
GetUrl();
}
void GetUrl(){
var uri = Uri.dataFromString(window.location.href); //converts string to a uri
Map<String, String> params = uri.queryParameters; // query parameters automatically populated
var param1 = params['param1']; // return value of parameter "param1" from uri
print(jsonEncode(params));//can use returned parameters to encode as json
setState(() {});
}
but am not getting any result. Thank you in advance
?a=b&c=d&e=f