Is your feature request related to a problem? Please describe.
I have to write down the freezed boilerplate.
Describe the solution you'd like
Similar to Equatable, would be awesome to just add freezed.
import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:meta/meta.dart';
part 'home_bloc.freezed.dart';
part 'home_event.dart';
part 'home_state.dart';
class HomeBloc extends Bloc<HomeEvent, HomeState> {
HomeBloc() : super(HomeState.initial());
@override
Stream<HomeState> mapEventToState(
HomeEvent event,
) async* {
// TODO: implement mapEventToState
}
}
```dart
part of 'home_bloc.dart';
@freezed
abstract class HomeState with _$HomeState {
const factory HomeState.initial() = HomeInitial;
}
```dart
part of 'home_bloc.dart';
@freezed
abstract class HomeEvent with _$HomeEvent {
const factory HomeEvent.refreshed() = HomeRefreshed;
}
Describe alternatives you've considered
Manually writing it 馃憥
I have writen a vscode extension that can just do that freezed_bloc.
@QAQyzk thanks for sharing, that's awesome 馃帀
What are your thoughts in migrating your extension into the current bloc extension in order to consolidate the snippets/tooling or would you prefer to keep them separate? I'm thinking we could do a similar thing to equatable where the extension inspects the pubpsec.yaml and if the project is using freezed generate a "freezed bloc".
Curious to hear if others have an opinion one way or another one this (@jomik).
@felangel I would love to see the function integrated to the bloc extension! But I'm not entirely sure how to add contribute to the repo, is there anything I can follow?