update README to use Dart 2.0 syntax
This commit is contained in:
parent
5090537969
commit
b70118b5c9
|
@ -46,15 +46,15 @@ There is a pretty sweet example project in the `example` folder. Check it out. O
|
||||||
|
|
||||||
First, you should define a new `Router` object by initializing it as such:
|
First, you should define a new `Router` object by initializing it as such:
|
||||||
```dart
|
```dart
|
||||||
final router = new Router();
|
final router = Router();
|
||||||
```
|
```
|
||||||
It may be convenient for you to store the router globally/statically so that
|
It may be convenient for you to store the router globally/statically so that
|
||||||
you can access the router in other areas in your application.
|
you can access the router in other areas in your application.
|
||||||
|
|
||||||
After instantiating the router, you will need to define your routes and your route handlers:
|
After instantiating the router, you will need to define your routes and your route handlers:
|
||||||
```dart
|
```dart
|
||||||
var usersHandler = new Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
|
var usersHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
|
||||||
return new UsersScreen(params["id"][0]);
|
return UsersScreen(params["id"][0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
void defineRoutes(Router router) {
|
void defineRoutes(Router router) {
|
||||||
|
|
Loading…
Reference in New Issue