Skip to content

Instantly share code, notes, and snippets.

@ryloric
Created July 12, 2020 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryloric/610546634ac84754730cdd9ede20fd3c to your computer and use it in GitHub Desktop.
Save ryloric/610546634ac84754730cdd9ede20fd3c to your computer and use it in GitHub Desktop.
ChangeNotifier
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