-
-
Save ijoschek/f97c85adf95a405ae1880c4d3d35aeea to your computer and use it in GitHub Desktop.
flutter_firestore_tut
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
//... | |
class _Home extends State<StatefulWidget> { | |
//... | |
@override | |
void initState() { | |
super.initState(); | |
_transactionListener = Firestore.instance | |
.collection('stats') | |
.document('interactions') | |
.snapshots() | |
.listen((data) => transactionListenerUpdate(data)); | |
} | |
void transactionListenerUpdate(data) { | |
var number = data['count']; | |
setState(() { | |
_interactionCount = number; | |
}); | |
} | |
//... | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
//... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment