24

I am getting started with Bloc in Flutter. Can anyone tell what is really "flutter_bloc" and "bloc" packages I have these questions.

  1. are they same.
  2. when/how to use this.
  • Thank you
Abhin Krishna KA
  • 745
  • 8
  • 13
  • 3
    bloc - is the base package (platform agnostic), flutter_bloc - is the package for flutter, anglular_bloc - for angular and so on... You can read it here: [https://bloclibrary.dev/#/gettingstarted](https://bloclibrary.dev/#/gettingstarted) – Thepeanut Aug 19 '20 at 07:34

2 Answers2

40

The 'bloc' package contains things you will use in your Bloc layer, like the Bloc class. This isn't necessarily flutter dependent, it is just the logic architecture of your app.

The 'flutter bloc' package contains elements you will use in your UI layer. It includes widgets like BlocProvider and BlocBuilder, which are widgets and thus flutter dependent.

Kris
  • 3,091
  • 20
  • 28
8

flutter_bloc is dependent on/derived from the bloc package. To implement bloc in a flutter app, all you need is the flutter_bloc package as it inherits/implements all the necessary classes from the bloc package.

GraSim
  • 3,830
  • 1
  • 29
  • 35