In Dart
, I understand how super
works like this :
class Foo {
Foo(int a, int b) {
//Code of constructor
}
}
class Bar extends Foo {
Bar(int a, int b) : super(a, b);
}
I don't really get what is happening when super
is used in the cubit
(or blocs
) classes of flutter_bloc
.
I'm not understanding for example when the CounterCubit
class extends Cubit
: CounterCubit extends Cubit<CounterState>
and the CounterState
class can be used as a parameter for the cubit
.
class CounterState {
int counterValue;
CounterState({@required this.counterValue});
}
class CounterCubit extends Cubit<CounterState> {
CounterCubit() : super(CounterState(counterValue: 0));
}