Skip to content

Instantly share code, notes, and snippets.

@nerdpepe
Created July 1, 2021 20:48
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 nerdpepe/2d551d26bfb6191eaeb06829ad8668ef to your computer and use it in GitHub Desktop.
Save nerdpepe/2d551d26bfb6191eaeb06829ad8668ef to your computer and use it in GitHub Desktop.
class MyService {
static final MyService _instance = MyService._internal();
factory MyService() => _instance;
int _myVariable = 0;
MyService._internal() {
_myVariable = 0;
}
int get myVariable => _myVariable;
set myVariable(int value) => myVariable = value;
void incrementMyVariable() => _myVariable++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment