Back to Bloc

Bloc Plugin for IntelliJ and Android Studio

extensions/intellij/README.md

latest4.0 KB
Original Source

Bloc Plugin for IntelliJ and Android Studio

Introduction

Bloc plugin for IntelliJ and Android Studio with support for the Bloc Library and provides tools for effectively creating Blocs and Cubits for both Flutter and AngularDart apps.

Installation

You can find the plugin in the official IntelliJ and Android Studio marketplace:

How to use

Simply right click on the File Project view, go to New -> Bloc Class, give it a name, select if you want to use Equatable, and click on OK to see all the boilerplate generated.

Quick code action

Wrapping a widget is also possible with Alt + ENTER shortcut. If you wish to disable this quick code action (Bloc) Wrap with you can do it so by going to Settings - Editor - Intentions - Bloc.

Equatable props generator

Right click and use Generate -> Equatable Props to automatically generate the props override when using Equatable.

Snippets

Bloc

ShortcutDescription
importblocImports package:bloc
importflutterblocImports package:flutter_bloc
importbloctestImports package:bloc_test
blocCreates a bloc class
cubitCreates a cubit class
blocobserverCreates a BlocObserver class
blocproviderCreates a BlocProvider widget
multiblocproviderCreates a MultiBlocProvider widget
repoproviderCreates a RepositoryProvider widget
multirepoproviderCreates a MultiRepositoryProvider widget
blocbuilderCreates a BlocBuilder widget
bloclistenerCreates a BlocListener widget
multibloclistenerCreates a MultiBlocListener widget
blocconsumerCreates a BlocConsumer widget
blocofShortcut for BlocProvider.of()
repoofShortcut for RepositoryProvider.of()
readShortcut for context.read()
watchShortcut for context.watch()
selectShortcut for context.select()
blocstateCreates a state class
bloceventCreates an event class
bloctestCreates a blocTest with build, act and expect
mockblocCreates a class extenting MockBloc
mockcubitCreates a class extending MockCubit
fakeCreates a class extending Fake

Freezed Bloc

ShortcutDescription
feventwhenCreates an event handler with freeze.when function
feventmapCreates an event handler with freeze.map function
fstateCreates a sub state
feventCreates a sub event

Deployment

Using Plugin Repository