Created
April 5, 2021 15:40
-
-
Save fredgrott/ab4b0f704ebfbf469f277a253be3aefc to your computer and use it in GitHub Desktop.
counter statenotifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CounterNotifier extends StateNotifier<CounterModel> with UtilityLogger { | |
CounterNotifier() : super(_initialValue); | |
static const _initialValue = CounterModel(0); | |
void increment() { | |
state = CounterModel(state.count + 1); | |
// log our state change | |
//myAppLog("count increased by 1"); | |
logger.info(penInfo("count increased by 1")); | |
} | |
} | |
class CounterModel { | |
const CounterModel(this.count); | |
final int count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment