'What is the use of extending model class with Equatable in flutter
class PushOtpResponse extends Equatable {
final bool? isSuccess;
final String? message;
const PushOtpResponse({this.isSuccess, this.message});
factory PushOtpResponse.fromJson(Map<String, dynamic> json) {
return PushOtpResponse(
isSuccess: json['isSuccess'] as bool?,
message: json['message'] as String?,
);
}
Map<String, dynamic> toJson() => {
'isSuccess': isSuccess,
'message': message,
};
@override
bool get stringify => true;
@override
List<Object?> get props => [isSuccess, message];
}
The model class given above is created using json to dart extension of VSCode. There is an option for extending the class with equatable. So, is there any use in extending a model class with equatable and is there any help 'stringify' can do here.
Solution 1:[1]
I'd suggest you to just read the documentation of Equatable. Equatable is not a default class of flutter, and whoever added that code to your project must have deliberately included the package
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ivo Beckers |
