BlocBuilder doesn't need to explicitly provide the State type again
- Dominant language
- Dart
- Stars
- 12.5k
- Forks
- 3.4k
- PR merge metrics
- No merged PRs in 30d
Description
i am not sure why we need to pass the state type again in BlocBuilder.
currently we would write
```dart
BlocBuilder(
builder: (BuildContext context, StateA state) => ...
)
```
but why can't we remove the StateA, and instead write
```dart
BlocBuilder(
builder: (BuildContext context, StateA state) => ...
)
```
since BlocA already defines the state type.
and checking the definition here
https://github.com/felangel/bloc/blob/805cf865fe0972e7f1bd24f08598d624066434fb/packages/flutter_bloc/lib/src/bloc_builder.dart#L18
why can't we just write it as
```dart
class BlocBuilder> extends BlocBuilderBase
```
i am not sure if this is a limitation in dart, but it's annoying that i have to pass the state type again for every BlocBuilder
Contributor guide
Assessment
This issue has not been assessed yet.