Split into multiple files
This commit is contained in:
23
lib/states/my_app_states.dart
Normal file
23
lib/states/my_app_states.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
library;
|
||||
|
||||
import 'package:english_words/english_words.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MyAppState extends ChangeNotifier {
|
||||
var current = WordPair.random();
|
||||
var favourites = <WordPair>[];
|
||||
|
||||
void getNext() {
|
||||
current = WordPair.random();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void toggleFavourites() {
|
||||
if (favourites.contains(current)) {
|
||||
favourites.remove(current);
|
||||
} else {
|
||||
favourites.add(current);
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user