A Flutter web application that demonstrates querystring parsing and conditional semantics enabling.
This app displays the current URL querystring and shows whether semantics are enabled based on the enableSemantics parameter. Semantics are only enabled when enableSemantics=true is present in the querystring.
- QueryString Display: Shows the current URL querystring (or "(empty)" if none)
- Semantics Status: Displays
trueorfalsebased on querystring value - Visual Indicators:
- Query string text is grey when empty, black when present
- Semantics status is green when
true, red whenfalse
- Refresh Button: Allows manual refresh of querystring parsing
- Flutter SDK installed
- Web browser for testing
-
Start the Flutter web server:
flutter run -d web-server --web-port 8080
-
Open your browser and navigate to
http://localhost:8080
Test the following URLs to see different behaviors:
http://localhost:8080
- Query String:
(empty) - Enable Semantics:
false(red)
http://localhost:8080?enableSemantics=true
- Query String:
enableSemantics=true - Enable Semantics:
true(green)
http://localhost:8080?enableSemantics=false
- Query String:
enableSemantics=false - Enable Semantics:
false(red)
http://localhost:8080?enableSemantics=True
http://localhost:8080?enableSemantics=TRUE
http://localhost:8080?enableSemantics=TrUe
- Query String:
enableSemantics=True(or any case variation) - Enable Semantics:
true(green)
http://localhost:8080?test=value
http://localhost:8080?enabled=true
http://localhost:8080?param=value
- Query String:
test=value(or whatever you put) - Enable Semantics:
false(red)
http://localhost:8080?param1=value1&enableSemantics=true¶m2=value2
- Query String:
param1=value1&enableSemantics=true¶m2=value2 - Enable Semantics:
true(green)
http://localhost:8080?param1=value1¶m2=value2
- Query String:
param1=value1¶m2=value2 - Enable Semantics:
false(red)
- Parameter-based: Semantics are enabled ONLY when
enableSemantics=trueis present in the querystring - Case insensitive:
enableSemantics=true,enableSemantics=True,enableSemantics=TRUEall work - Value sensitive: Only
enableSemantics=true(case insensitive) enables semantics;enableSemantics=falseor any other value disables it - Refresh functionality: Use the "Refresh" button to re-parse the current URL without reloading the page
- Real-time updates: Change the URL in the browser address bar and click "Refresh" to see immediate updates
| QueryString | Enable Semantics | Display Color |
|---|---|---|
| (empty) | false |
Red |
enableSemantics=true |
true |
Green |
enableSemantics=false |
false |
Red |
test=value |
false |
Red |
enabled=true |
false |
Red |
param1=value1&enableSemantics=true¶m2=value2 |
true |
Green |
| Any other value | false |
Red |
- Built with Flutter for web
- Uses
dart:htmlto access browser URL - Uses
Uri.queryParametersto parse querystring parameters - Stateful widget with manual refresh capability
- Material Design UI with responsive layout