mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-07-11 07:07:16 +08:00
17 lines
323 B
Dart
17 lines
323 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class Todo extends ChangeNotifier {
|
|
final String id;
|
|
String title;
|
|
bool done;
|
|
|
|
Todo({@required this.id, this.title, this.done = false});
|
|
|
|
|
|
/// Toggles the value of the item and notify to listeners
|
|
void toggle() {
|
|
this.done = !this.done;
|
|
notifyListeners();
|
|
}
|
|
}
|