You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
516 B
Dart
20 lines
516 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Counter with ChangeNotifier, DiagnosticableTreeMixin {
|
|
int _count = 0;
|
|
|
|
int get count => _count;
|
|
|
|
void increment() {
|
|
_count++;
|
|
notifyListeners();
|
|
}
|
|
|
|
/// Makes `Counter` readable inside the devtools by listing all of its properties
|
|
@override
|
|
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
|
|
super.debugFillProperties(properties);
|
|
properties.add(IntProperty('count', count));
|
|
}
|
|
} |