2

I downloaded my code from FlutterFlow and I'm trying to run it. But it gives me this error

Error: The class 'NavigatorObserver' can't be used as a mixin because it isn't a mixin class nor a mixin.

Here is a version of the code from FlutterFlow

class GoRouter extends ChangeNotifier with NavigatorObserver {
...
}

Any help is appreciated thanks

rtp_46
  • 25
  • 3
  • What is a NavigatorObserver class, Please add a code snippet of it. If you recently updated to latest Flutter and Dart, then there is a breaking change. If you want to use a class as mixin then add mixin to the class `mixin class NavigatorObserver{}` https://dart.dev/resources/dart-3-migration#mixin – Mohan Sai Manthri Jun 01 '23 at 01:59

1 Answers1

0

Try replacing the extends with implements:

class GoRouter implements ChangeNotifier with NavigatorObserver {
  ...
}
Tyler2P
  • 2,324
  • 26
  • 22
  • 31