Modified README
This commit is contained in:
parent
c63ee84acb
commit
5f8369e66f
3 changed files with 8 additions and 2 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -49,8 +49,9 @@ atlassian-ide-plugin.xml
|
||||||
com_crashlytics_export_strings.xml
|
com_crashlytics_export_strings.xml
|
||||||
crashlytics.properties
|
crashlytics.properties
|
||||||
crashlytics-build.properties
|
crashlytics-build.properties
|
||||||
|
|
||||||
### Dart template
|
### Dart template
|
||||||
# Don’t commit the following directories created by pub.
|
# Don't commit the following directories created by pub.
|
||||||
.buildlog
|
.buildlog
|
||||||
.pub/
|
.pub/
|
||||||
build/
|
build/
|
||||||
|
@ -66,3 +67,5 @@ packages
|
||||||
# Include when developing application packages.
|
# Include when developing application packages.
|
||||||
pubspec.lock
|
pubspec.lock
|
||||||
|
|
||||||
|
doc/api
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,12 @@ main() async {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also use `buildMapFromUri(Map, String)` to populate a map from a URL encoded string.
|
||||||
|
|
||||||
This can easily be used with a library like [JSON God](https://github.com/thosakwe/json_god)
|
This can easily be used with a library like [JSON God](https://github.com/thosakwe/json_god)
|
||||||
to build structured JSON/REST APIs. Add validation and you've got an instant backend.
|
to build structured JSON/REST APIs. Add validation and you've got an instant backend.
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
|
|
||||||
MyClass create(HttpRequest request) async {
|
MyClass create(HttpRequest request) async {
|
||||||
God god = new God();
|
God god = new God();
|
||||||
return god.deserialize(await parseBody(request).body, MyClass);
|
return god.deserialize(await parseBody(request).body, MyClass);
|
||||||
|
|
|
@ -44,6 +44,8 @@ Future<BodyParseResult> parseBody(HttpRequest request) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parses a URI-encoded string into real data! **Wow!**
|
/// Parses a URI-encoded string into real data! **Wow!**
|
||||||
|
///
|
||||||
|
/// Whichever map you provide will be automatically populated from the urlencoded body string you provide.
|
||||||
buildMapFromUri(Map map, String body) {
|
buildMapFromUri(Map map, String body) {
|
||||||
God god = new God();
|
God god = new God();
|
||||||
for (String keyValuePair in body.split('&')) {
|
for (String keyValuePair in body.split('&')) {
|
||||||
|
|
Loading…
Reference in a new issue