Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/go_router_builder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.0.0

- Make Route mixins public.

## 3.3.1

- Fixes warnings in generated code of iterable parameters.
Expand Down
27 changes: 15 additions & 12 deletions packages/go_router_builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ dart run build_runner build
Read more about using
[`build_runner` on pub.dev](https://pub.dev/packages/build_runner).

## Migration Guides
- [Migrating to 4.0.0](https://flutter.dev/go/go-router-builder-v4-breaking-changes).

## Overview

`go_router` fundamentally relies on the ability to match a string-based location
Expand Down Expand Up @@ -86,7 +89,7 @@ method.

<?code-excerpt "example/lib/readme_excerpts.dart (HomeRoute)"?>
```dart
class HomeRoute extends GoRouteData with _$HomeRoute {
class HomeRoute extends GoRouteData with $HomeRoute {
const HomeRoute();

@override
Expand All @@ -106,7 +109,7 @@ The tree of routes is defined as an attribute on each of the top-level routes:
TypedGoRoute<FamilyRoute>(path: 'family/:fid'),
],
)
class HomeRoute extends GoRouteData with _$HomeRoute {
class HomeRoute extends GoRouteData with $HomeRoute {
const HomeRoute();

@override
Expand All @@ -122,7 +125,7 @@ class RedirectRoute extends GoRouteData {
}

@TypedGoRoute<LoginRoute>(path: '/login')
class LoginRoute extends GoRouteData with _$LoginRoute {
class LoginRoute extends GoRouteData with $LoginRoute {
LoginRoute({this.from});
final String? from;

Expand Down Expand Up @@ -210,7 +213,7 @@ Parameters (named or positional) not listed in the path of `TypedGoRoute` indica
<?code-excerpt "example/lib/readme_excerpts.dart (login)"?>
```dart
@TypedGoRoute<LoginRoute>(path: '/login')
class LoginRoute extends GoRouteData with _$LoginRoute {
class LoginRoute extends GoRouteData with $LoginRoute {
LoginRoute({this.from});
final String? from;

Expand All @@ -228,7 +231,7 @@ For query parameters with a **non-nullable** type, you can define a default valu
<?code-excerpt "example/lib/readme_excerpts.dart (MyRoute)"?>
```dart
@TypedGoRoute<MyRoute>(path: '/my-route')
class MyRoute extends GoRouteData with _$MyRoute {
class MyRoute extends GoRouteData with $MyRoute {
MyRoute({this.queryParameter = 'defaultValue'});
final String queryParameter;

Expand All @@ -249,7 +252,7 @@ parameter with the special name `$extra`:

<?code-excerpt "example/lib/readme_excerpts.dart (PersonRouteWithExtra)"?>
```dart
class PersonRouteWithExtra extends GoRouteData with _$PersonRouteWithExtra {
class PersonRouteWithExtra extends GoRouteData with $PersonRouteWithExtra {
PersonRouteWithExtra(this.$extra);
final Person? $extra;

Expand Down Expand Up @@ -281,7 +284,7 @@ You can, of course, combine the use of path, query and $extra parameters:
```dart
@TypedGoRoute<HotdogRouteWithEverything>(path: '/:ketchup')
class HotdogRouteWithEverything extends GoRouteData
with _$HotdogRouteWithEverything {
with $HotdogRouteWithEverything {
HotdogRouteWithEverything(this.ketchup, this.mustard, this.$extra);
final bool ketchup; // A required path parameter.
final String? mustard; // An optional query parameter.
Expand Down Expand Up @@ -341,7 +344,7 @@ The code generator can convert simple types like `int`, `enum`, and `extension t
enum BookKind { all, popular, recent }

@TypedGoRoute<BooksRoute>(path: '/books')
class BooksRoute extends GoRouteData with _$BooksRoute {
class BooksRoute extends GoRouteData with $BooksRoute {
BooksRoute({this.kind = BookKind.popular});
final BookKind kind;

Expand Down Expand Up @@ -370,7 +373,7 @@ method of the base class instead of the `build` method:

<?code-excerpt "example/lib/readme_excerpts.dart (MyMaterialRouteWithKey)"?>
```dart
class MyMaterialRouteWithKey extends GoRouteData with _$MyMaterialRouteWithKey {
class MyMaterialRouteWithKey extends GoRouteData with $MyMaterialRouteWithKey {
const MyMaterialRouteWithKey();
static const LocalKey _key = ValueKey<String>('my-route-with-key');
@override
Expand All @@ -386,7 +389,7 @@ Overriding the `buildPage` method is also useful for custom transitions:

<?code-excerpt "example/lib/readme_excerpts.dart (FancyRoute)"?>
```dart
class FancyRoute extends GoRouteData with _$FancyRoute {
class FancyRoute extends GoRouteData with $FancyRoute {
const FancyRoute();
@override
CustomTransitionPage<void> buildPage(
Expand Down Expand Up @@ -442,7 +445,7 @@ class MyShellRouteData extends ShellRouteData {
}

// For GoRoutes:
class MyGoRouteData extends GoRouteData with _$MyGoRouteData {
class MyGoRouteData extends GoRouteData with $MyGoRouteData {
const MyGoRouteData();

static final GlobalKey<NavigatorState> $parentNavigatorKey = rootNavigatorKey;
Expand All @@ -463,7 +466,7 @@ Define a relative route by extending `RelativeGoRouteData`.
<?code-excerpt "example/lib/readme_excerpts.dart (relativeRoute)"?>
```dart
@TypedRelativeGoRoute<DetailsRoute>(path: 'details')
class DetailsRoute extends RelativeGoRouteData with _$DetailsRoute {
class DetailsRoute extends RelativeGoRouteData with $DetailsRoute {
const DetailsRoute();

@override
Expand Down
22 changes: 11 additions & 11 deletions packages/go_router_builder/example/lib/all_extension_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ part 'all_extension_types.g.dart';
],
)
@immutable
class AllTypesBaseRoute extends GoRouteData with _$AllTypesBaseRoute {
class AllTypesBaseRoute extends GoRouteData with $AllTypesBaseRoute {
const AllTypesBaseRoute();

@override
Expand All @@ -59,7 +59,7 @@ extension type const UriExtension(Uri value) {}
extension type const PersonDetailsExtension(PersonDetails value) {}
extension type const SportDetailsExtension(SportDetails value) {}

class BigIntExtensionRoute extends GoRouteData with _$BigIntExtensionRoute {
class BigIntExtensionRoute extends GoRouteData with $BigIntExtensionRoute {
const BigIntExtensionRoute({
required this.requiredBigIntField,
this.bigIntField,
Expand All @@ -82,7 +82,7 @@ class BigIntExtensionRoute extends GoRouteData with _$BigIntExtensionRoute {
);
}

class BoolExtensionRoute extends GoRouteData with _$BoolExtensionRoute {
class BoolExtensionRoute extends GoRouteData with $BoolExtensionRoute {
const BoolExtensionRoute({
required this.requiredBoolField,
this.boolField,
Expand All @@ -108,7 +108,7 @@ class BoolExtensionRoute extends GoRouteData with _$BoolExtensionRoute {
);
}

class DateTimeExtensionRoute extends GoRouteData with _$DateTimeExtensionRoute {
class DateTimeExtensionRoute extends GoRouteData with $DateTimeExtensionRoute {
const DateTimeExtensionRoute({
required this.requiredDateTimeField,
this.dateTimeField,
Expand All @@ -131,7 +131,7 @@ class DateTimeExtensionRoute extends GoRouteData with _$DateTimeExtensionRoute {
);
}

class DoubleExtensionRoute extends GoRouteData with _$DoubleExtensionRoute {
class DoubleExtensionRoute extends GoRouteData with $DoubleExtensionRoute {
const DoubleExtensionRoute({
required this.requiredDoubleField,
this.doubleField,
Expand All @@ -157,7 +157,7 @@ class DoubleExtensionRoute extends GoRouteData with _$DoubleExtensionRoute {
);
}

class IntExtensionRoute extends GoRouteData with _$IntExtensionRoute {
class IntExtensionRoute extends GoRouteData with $IntExtensionRoute {
const IntExtensionRoute({
required this.requiredIntField,
this.intField,
Expand All @@ -183,7 +183,7 @@ class IntExtensionRoute extends GoRouteData with _$IntExtensionRoute {
);
}

class NumExtensionRoute extends GoRouteData with _$NumExtensionRoute {
class NumExtensionRoute extends GoRouteData with $NumExtensionRoute {
const NumExtensionRoute({
required this.requiredNumField,
this.numField,
Expand All @@ -209,7 +209,7 @@ class NumExtensionRoute extends GoRouteData with _$NumExtensionRoute {
);
}

class EnumExtensionRoute extends GoRouteData with _$EnumExtensionRoute {
class EnumExtensionRoute extends GoRouteData with $EnumExtensionRoute {
const EnumExtensionRoute({
required this.requiredEnumField,
this.enumField,
Expand Down Expand Up @@ -239,7 +239,7 @@ class EnumExtensionRoute extends GoRouteData with _$EnumExtensionRoute {
}

class EnhancedEnumExtensionRoute extends GoRouteData
with _$EnhancedEnumExtensionRoute {
with $EnhancedEnumExtensionRoute {
const EnhancedEnumExtensionRoute({
required this.requiredEnumField,
this.enumField,
Expand Down Expand Up @@ -268,7 +268,7 @@ class EnhancedEnumExtensionRoute extends GoRouteData
);
}

class StringExtensionRoute extends GoRouteData with _$StringExtensionRoute {
class StringExtensionRoute extends GoRouteData with $StringExtensionRoute {
const StringExtensionRoute({
required this.requiredStringField,
this.stringField,
Expand All @@ -294,7 +294,7 @@ class StringExtensionRoute extends GoRouteData with _$StringExtensionRoute {
);
}

class UriExtensionRoute extends GoRouteData with _$UriExtensionRoute {
class UriExtensionRoute extends GoRouteData with $UriExtensionRoute {
const UriExtensionRoute({required this.requiredUriField, this.uriField});

final UriExtension requiredUriField;
Expand Down
46 changes: 23 additions & 23 deletions packages/go_router_builder/example/lib/all_extension_types.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading