Created
July 3, 2021 00:42
-
-
Save dhruvilp/1edea99ed9a0c12779a8194b848a710d to your computer and use it in GitHub Desktop.
Get Current URL Query Parameters, Host Info, etc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:html'; | |
| void main() { | |
| // Uri uri = Uri.parse('https://www.example.com:3000/fruit?q=yellow'); | |
| Uri uri = Uri.parse(window.location.href); | |
| print('Authority: '+uri.authority); | |
| print('Fragment: '+uri.fragment); | |
| print('Host: '+uri.host); | |
| print('Origin: '+uri.origin); | |
| print('Path: '+uri.path); | |
| print('Query: '+uri.query); | |
| print('Query Params: '+uri.queryParameters.toString()); | |
| print('Scheme: '+uri.scheme); | |
| print('Port: '+uri.port.toString()); | |
| print('Path Segments: '+uri.pathSegments.toString()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment