24 lines
474 B
Dart
24 lines
474 B
Dart
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();
|
|
}
|
|
}
|