Skip to content

Instantly share code, notes, and snippets.

@chimon2000
Created November 1, 2020 06:55
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 chimon2000/d3c06806934a89854b290fac87b4f931 to your computer and use it in GitHub Desktop.
Save chimon2000/d3c06806934a89854b290fac87b4f931 to your computer and use it in GitHub Desktop.
state_example: mobx note store
part 'notes.g.dart';
class Notes = NotesBase with _$Notes;
abstract class NotesBase with Store {
@observable
String input = '';
@observable
ObservableList<String> notes = ObservableList();
@action
void updateInput(String val) {
input = val;
}
@action
void addNote() {
notes.add(input);
input = '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment