'How to use flutter equatable in StatelessWidget?
there is a way to use equatable in StatelessWidget?
I can implement it, but when I compare two StatelessWidget, equatable does not seem to work at all.
class Blog extends StatelessWidget implements Equatable {
const Blog({Key? key}) : super(key: key);
@override
List<Object?> get props => [];
@override
bool? get stringify => true;
@override
Widget build(BuildContext context) {
return Scaffold(body: Container());
}
instead when I use override '==' operator, works well when comparing two widgets, but I get The member '==' is declared non-virtual in 'Widget' and can't be overridden in subclasses warning, which ruins my work in flutter analyze.
@override
bool operator == (Object other) =>
identical(this, other) ||
other is Blog && runtimeType == other.runtimeType;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
