AuthenticationEvent build error with Equatable
seems that Equatable API had changed and the code at the events part do not build any longer, i have the following code:
import 'dart:io'; import 'package:equatable/equatable.dart'; import 'package:meta/meta.dart';
@immutable
abstract class AuthenticationEvent extends Equatable {
const AuthenticationEvent([List props = const
class ScreenEntered extends AuthenticationEvent { @override String toSring() => "ScreenEntered"; }
and getting an error that i am missing a getter for Equatable.props, i think this is related to API change
seems that Equatable API had changed and the code at the events part do not build any longer, i have the following code:
import 'dart:io'; import 'package:equatable/equatable.dart'; import 'package:meta/meta.dart';
@immutable abstract class AuthenticationEvent extends Equatable { const AuthenticationEvent([List props = const []]) : super(); }
class ScreenEntered extends AuthenticationEvent { @override String toSring() => "ScreenEntered"; }
and getting an error that i am missing a getter for Equatable.props, i think this is related to API change
Yes. The newer API needs you to override the get props method instead of passing the class fields to super class. I'll update the code with the latest version of both equatable and flutter_bloc soon. Thanks.
thanks for your update, any chance you can provide me with short code snippet for my current issue?
thanks for your update, any chance you can provide me with short code snippet for my current issue? Sure. This is the new way of doing things in equatable. You need to declare your variables in the props override now.
abstract class AuthenticationEvent extends Equatable {
@override
List<Object> get props => [];
}
class ScreenEntered extends AuthenticationEvent {
@override
String toSring() => "ScreenEntered";
}