Working with flutter I'm straggling with notifying a model class parameters about changes coming from the firestore DB.
I'm trying to use plugin property_change_notifier Using the example:
// ignore: mixin_inherits_from_not_object
class MyModel with PropertyChangeNotifier<String> {
int _foo = 0;
int _bar = 0;
int get foo => _foo;
int get bar => _bar;
set foo(int value) {
_foo = value;
notifyListeners('foo');
}
set bar(int value) {
_bar = value;
notifyListeners('bar');
}
}
I've added the ignore remark and even tried to set the analysis_option.yaml with this rule I still get the message:
The class 'PropertyChangeNotifier' can't be used as a mixin because it extends a class other than Object.dart(mixin_inherits_from_not_object)
When I try to build the project it then shows the following error:
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/ngplayground/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorWidgetOfExactType'.
return nullCheck(context.ancestorWidgetOfExactType(type) as PropertyChangeModel);
^^^^^^^^^^^^^^^^^^^^^^^^^
2
FAILURE: Build failed with an exception.
* Where:
Script 'C:\ngplayground\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
What is wrong here?