Created
May 10, 2019 10:58
-
-
Save itsatifsiddiqui/4f8a314569f1f692d66ec0f72f09b1ca to your computer and use it in GitHub Desktop.
Counter Class
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'; | |
class Counter with ChangeNotifier { | |
int _counter; | |
Counter(this._counter); | |
getCounter() => _counter; | |
setCounter(int counter) => _counter = counter; | |
void increment() { | |
_counter++; | |
notifyListeners(); | |
} | |
void decrement() { | |
_counter--; | |
notifyListeners(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment