Skip to content
Merged
Prev Previous commit
Next Next commit
format fixes
  • Loading branch information
dancamdev committed Apr 3, 2023
commit 21cf5f6d16b7416353b2f552d33fc2cc802a2d4e
9 changes: 4 additions & 5 deletions packages/go_router_builder/example/lib/extra_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class OptionalExtraRoute extends GoRouteData {
OptionalExtraScreen(extra: $extra);
}


class OptionalExtraScreen extends StatelessWidget {
const OptionalExtraScreen({super.key, this.extra});

Expand All @@ -80,7 +79,6 @@ class OptionalExtraScreen extends StatelessWidget {
}
}


@TypedGoRoute<SplashRoute>(path: '/splash')
class SplashRoute extends GoRouteData {
const SplashRoute();
Expand All @@ -89,7 +87,6 @@ class SplashRoute extends GoRouteData {
Widget build(BuildContext context, GoRouterState state) => const Splash();
}


class Splash extends StatelessWidget {
const Splash({super.key});

Expand All @@ -102,11 +99,13 @@ class Splash extends StatelessWidget {
children: [
const Placeholder(),
ElevatedButton(
onPressed: () => const RequiredExtraRoute($extra: Extra(1)).go(context),
onPressed: () =>
const RequiredExtraRoute($extra: Extra(1)).go(context),
child: const Text('Required Extra'),
),
ElevatedButton(
onPressed: () => const OptionalExtraRoute($extra: Extra(2)).go(context),
onPressed: () =>
const OptionalExtraRoute($extra: Extra(2)).go(context),
child: const Text('Optional Extra'),
),
ElevatedButton(
Expand Down
5 changes: 4 additions & 1 deletion packages/go_router_builder/lib/src/route_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,10 @@ GoRoute get $_routeGetterName => ${_routeDefinition()};

String get _newFromState {
final StringBuffer buffer = StringBuffer('=>');
if (_ctor.isConst && _ctorParams.isEmpty && _ctorQueryParams.isEmpty && _extraParam == null) {
if (_ctor.isConst &&
_ctorParams.isEmpty &&
_ctorQueryParams.isEmpty &&
_extraParam == null) {
buffer.writeln('const ');
}

Expand Down