← Open Source
ai skill

utopia-hooks-migrate-bloc

A 5-agent pipeline that takes a BLoC/Cubit codebase to utopia_hooks screen by screen, behind a hard exit gate that proves no BLoC is left.

/plugin marketplace add Utopia-USS/utopia-flutter-skills /plugin install utopia-hooks-migrate-bloc@utopia-flutter-skills
why it exists
BLoC earns its keep on a small app. On a large one the bill comes due: maintenance compounds, state composes badly, and pulling a fragment of business logic out to reuse it fights the pattern the whole way. Every screen pays the same tax - a Cubit, a state class, a provider, a BlocBuilder - for logic that utopia_hooks expresses as a single hook. Leaving BLoC by hand is the job that stalls at 80%: a few screens still on flutter_bloc, a stray Cubit nobody dared touch, no way to prove the codebase is off the pattern. This skill runs the migration as a pipeline instead. Five agents - inventory, foundation, global state, screen, and review - take the codebase to utopia_hooks one screen at a time, from a concept map that pins every BLoC construct to its equivalent: Cubit becomes a hook function, emit becomes useState, BlocProvider becomes a _providers entry.

The migration is not done when it looks done. It is done when it passes a 7-point exit gate: flutter pub get passes, dart analyze returns zero errors, and audit greps prove there is no BLoC residue left anywhere - no imports, no *_bloc.dart files, no pubspec entries. The roughly 30% less code that falls out is a consequence of the rewrite being correct, not the goal. We publish the skill: a CTO can read how the migration runs before committing a codebase to it, and it is the same machine our team runs on client work in an Architecture engagement.

The destination pattern is the utopia-hooks skill's Screen/State/View structure - this migration exists to land a codebase there.
utopia-hooks-migrate-bloc/SKILL.md8 refs
name
utopia-hooks-migrate-bloc
Referencesstate → screen patterns
BLoC → hooks: stateCRITICAL
BLoC → hooks: widgetCRITICAL
pubspec migrationCRITICAL
Migration stepsHIGH
Global-state migrationHIGH
Screen migration flowHIGH
Complex Cubit patternsHIGH
Post-migration refactorHIGH
Read the full skill
usage

Same behavior, before the migration and after:

// Before: a Cubit, a state class, a provider, and a BlocBuilder.
class CounterCubit extends Cubit<int> {
  CounterCubit() : super(0);
  void increment() => emit(state + 1);
}
// ...wired with BlocProvider, read with a BlocBuilder in the widget.

// After: the Cubit becomes a hook function, emit becomes useState,
// and BlocProvider becomes a _providers entry.
CounterState useCounterState() {
  final count = useState(0);
  return CounterState(
    count: count.value,
    increment: () => count.value++,
  );
}
talk to us

Want this in your build?

The team behind utopia-hooks-migrate-bloc ships production Flutter on the same stack. Tell us what you are building.