Vilda
Vilda

Reputation: 1793

Dart variables in URL

Is there a way in Dart to fetch variables from the loading URL?

For example, from this URL:

 website.com?var_A=7&var_B=192

can I retreive the variables var_A and var_B?

Upvotes: 4

Views: 108

Answers (1)

Robert
Robert

Reputation: 5662

Uri uri = Uri.parse('website.com?var_A=7&var_B=192');
print(uri.queryParameters['var_A']);
print(uri.queryParameters['var_B']);

prints

7
192

Upvotes: 6

Related Questions