Skip to content

[go_router_builder] The resulting file produces the warning "The getter doesn't override an inherited getter." #170241

Closed
@Kirara02

Description

@Kirara02

Steps to reproduce

  1. make router file with go_router_builder ^3.0.0 and go_router ^15.1.3
  2. run in terminal "dart run build_runner build -d"

The resulting file produces a warning "Getter does not override inherited getter." I get this warning in every mixin of the GoRouteData class such as in the location, go, push, and other functions. Although this does not make the application crash, I want my code to be clean.

Expected results

result

Actual results

The getter doesn't override an inherited getter.
Try updating this class to match the superclass, or removing the override annotation.

Code sample

Code sample
@TypedGoRoute<SplashRoute>(path: Routes.splash)
class SplashRoute extends GoRouteData  with _$SplashRoute{
  const SplashRoute();

  static final $parentNavigatorKey = _rootNavigatorKey;

  @override
  Widget build(BuildContext context, GoRouterState state) => const SplashScreen();
}

// in router.g.dart

RouteBase get $splashRoute => GoRouteData.$route(
      path: '/',
      parentNavigatorKey: SplashRoute.$parentNavigatorKey,
      factory: _$SplashRoute._fromState,
    );

mixin _$SplashRoute on GoRouteData {
  static SplashRoute _fromState(GoRouterState state) => const SplashRoute();

  @override
  String get location => GoRouteData.$location(
        '/',
      );

  @override
  void go(BuildContext context) => context.go(location);

  @override
  Future<T?> push<T>(BuildContext context) => context.push<T>(location);

  @override
  void pushReplacement(BuildContext context) =>
      context.pushReplacement(location);

  @override
  void replace(BuildContext context) => context.replace(location);
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.2, on macOS 13.7.6 22H625 darwin-x64, locale en-ID)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.3.2.2)
[✓] VS Code (version 1.100.3)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packagepackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions