-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acf3fb7
commit 54bc43e
Showing
3 changed files
with
87 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
Map<String, String> getURLArgs(String str) { | ||
// return the URL arguments in a Map | ||
Map<String, String> result = {}; | ||
|
||
// components of URL | ||
List comp = []; | ||
List pair = []; | ||
|
||
// get index of first question mark | ||
var firstQm = str.indexOf('?'); | ||
// get index of first & | ||
var firstAmp = str.indexOf('&'); | ||
|
||
// check if there is a ? | ||
if (firstQm > 0) { | ||
comp = str.split('?'); | ||
//print(comp); | ||
var newStr = comp[1]; // the portion after ? | ||
|
||
if (firstAmp > 0) { | ||
//split | ||
comp = newStr.split('&'); | ||
//print(comp); | ||
} | ||
|
||
for (var i = 0; i < comp.length; i++) { | ||
// extract out each section | ||
//print(comp[i]); | ||
pair = comp[i].split('='); | ||
print(pair); | ||
// insert into map | ||
result[pair[0]] = pair[1]; | ||
} | ||
/*result["id"] = 'abcd'; | ||
result["time"] = '3.0';*/ | ||
} | ||
return result; | ||
} |
This file contains 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