Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>blocNew to Visual Studio Code? Get it now.
bloc

bloc

Felix Angelov

|
669,433 installs
| (19) | Free
Support for the bloc library and provides tools for effectively creating blocs for both Flutter and AngularDart apps.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Bloc

build codecov Star on Github

Version Downloads Installs Ratings Flutter Website Awesome Flutter Flutter Samples License: MIT Discord Bloc Library


Overview

VSCode support for the Bloc Library and provides tools for effectively creating Blocs and Cubits for both Flutter and AngularDart apps.

Installation

Bloc can be installed from the VSCode Marketplace or by searching within VSCode.

Language Server

By default, the bloc language server started which enables custom bloc diagnotic reporting. See [https://pub.dev/packages/bloc_lint] for more information about supported lint rules.

Commands

Command Description
Bloc: New Bloc Generate a new Bloc
Cubit: New Cubit Generate a new Cubit

You can activate the commands by launching the command palette (View -> Command Palette) and running entering the command name or you can right click on the directory in which you'd like to create the bloc/cubit and select the command from the context menu.

demo

Code Actions

Action Description
Convert to MultiBlocListener Converts current BlocListener into a MultiBlocListener
Convert to MultiBlocProvider Converts current BlocProvider into a MultiBlocProvider
Convert to MultiRepositoryProvider Converts current RepositoryProvider into a MultiRepositoryProvider
Wrap with BlocBuilder Wraps current widget in a BlocBuilder
Wrap with BlocSelector Wraps current widget in a BlocSelector
Wrap with BlocListener Wraps current widget in a BlocListener
Wrap with BlocConsumer Wraps current widget in a BlocConsumer
Wrap with BlocProvider Wraps current widget in a BlocProvider
Wrap with RepositoryProvider Wraps current widget in a RepositoryProvider

demo

Snippets

Bloc

Shortcut Description
importbloc Imports package:bloc
importflutterbloc Imports package:flutter_bloc
importbloctest Imports package:bloc_test
bloc Creates a bloc class
cubit Creates a cubit class
onevent Register a new EventHandler
_onevent Define a new EventHandler
blocobserver Creates a BlocObserver class
blocprovider Creates a BlocProvider widget
multiblocprovider Creates a MultiBlocProvider widget
repoprovider Creates a RepositoryProvider widget
multirepoprovider Creates a MultiRepositoryProvider widget
blocbuilder Creates a BlocBuilder widget
blocselector Creates a BlocSelector widget
bloclistener Creates a BlocListener widget
multibloclistener Creates a MultiBlocListener widget
blocconsumer Creates a BlocConsumer widget
blocof Shortcut for BlocProvider.of()
repoof Shortcut for RepositoryProvider.of()
read Shortcut for context.read()
watch Shortcut for context.watch()
select Shortcut for context.select()
blocstate Creates a state class
blocevent Creates an event class
bloctest Creates a blocTest
mockbloc Creates a class extending MockBloc
_mockbloc Creates a private class extending MockBloc
mockcubit Creates a class extending MockCubit
_mockcubit Creates a private class extending MockCubit
fake Creates a class extending Fake
_fake Creates a private class extending Fake
mock Creates a class extending Mock
_mock Creates a private class extending Mock

Freezed Bloc

Shortcut Description
fstate Creates a freezed state
fevent Creates a freezed event
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft