Skip to content

Instantly share code, notes, and snippets.

@chimon2000
Created November 1, 2020 06:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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