Created
July 12, 2020 11:49
-
-
Save ryloric/610546634ac84754730cdd9ede20fd3c to your computer and use it in GitHub Desktop.
ChangeNotifier
This file contains 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
import 'package:flutter/material.dart'; | |
void main() { | |
print("Hello World!"); | |
var notifier = TestNotifier(); | |
var listener1 = () { | |
print("Inside listener 1"); | |
}; | |
var listener2 = () { | |
print("Inside listener 2"); | |
}; | |
notifier.addListener(listener1); | |
notifier.addListener(listener1); | |
notifier.pingListeners(); | |
} | |
class TestNotifier extends ChangeNotifier { | |
void pingListeners() { | |
this.notifyListeners(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment