Line data Source code
1 : import 'package:collection/collection.dart'; 2 : 3 : import 'package:widgetbook/src/models/models.dart'; 4 : 5 : class OrganizerState { 6 2 : OrganizerState({ 7 : required this.allCategories, 8 : required this.filteredCategories, 9 : required this.searchTerm, 10 : }); 11 : 12 2 : factory OrganizerState.unfiltered({ 13 : required List<Category> categories, 14 : }) { 15 2 : return OrganizerState( 16 : allCategories: categories, 17 : filteredCategories: categories, 18 : searchTerm: '', 19 : ); 20 : } 21 : 22 : final List<Category> allCategories; 23 : final List<Category> filteredCategories; 24 : final String searchTerm; 25 : 26 1 : @override 27 : bool operator ==(Object other) { 28 : if (identical(this, other)) return true; 29 1 : final listEquals = const DeepCollectionEquality().equals; 30 : 31 1 : return other is OrganizerState && 32 2 : listEquals(other.allCategories, allCategories) && 33 2 : listEquals(other.filteredCategories, filteredCategories) && 34 3 : other.searchTerm == searchTerm; 35 : } 36 : 37 1 : @override 38 : int get hashCode => 39 3 : allCategories.hashCode ^ 40 3 : filteredCategories.hashCode ^ 41 2 : searchTerm.hashCode; 42 : }