Skip to content

Commit ed53d56

Browse files
committed
update
1 parent f1611e8 commit ed53d56

16 files changed

+3314
-678
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,27 @@ A lightweight router designed for ease of use and efficient state management.
2727
Create classes that extend `RouteState` for each distinct route in your application. These classes encapsulate the path and can manage query parameters.
2828

2929
```dart
30-
// Define specific route states for type safety and clarity
30+
// Define specific route states for type safety and clarity.
3131
final class HomeRouteState extends RouteState {
32-
HomeRouteState() : super.parse('/home');
32+
HomeRouteState()
33+
: super.parse(
34+
'/home',
35+
// Use QuickForwardtEffect() as the default transtion effect for this
36+
// route. This can be overridden when pushing this route.
37+
animationEffect: QuickForwardtEffect(),
38+
);
3339
}
3440
35-
final class MessagesRouteState extends RouteState {
36-
MessagesRouteState() : super.parse('/messages');
37-
}
38-
39-
// Route state with specific query parameters
40-
final class MessagesWithQueryRouteState extends RouteState {
41-
MessagesWithQueryRouteState({String? key1Value})
42-
: super.parse('/messages', queryParameters: key1Value != null ? {'key1': key1Value} : null);
43-
}
44-
45-
// Route state expecting typed 'extra' data
46-
final class ChatRouteState extends RouteState<String> { // Expects a String as extra data
47-
ChatRouteState({String? chatId})
48-
: super.parse(chatId != null ? '/chat?id=$chatId' : '/chat');
41+
final class ChatRouteState extends RouteState {
42+
// Required chatId before pushing this route.
43+
ChatRouteState({required String chatId})
44+
: super.parse(
45+
'/chat',
46+
// Pass chatId as a query parameter.
47+
queryParameters: {chatId: chatId},
48+
// Use a different animation effect for this route.
49+
animationEffect: TopToBottomEffect(),
50+
);
4951
}
5052
```
5153

0 commit comments

Comments
 (0)