Using the Flutter Entity generator for JHipster

Cyril Casaucau
3 min readJun 30, 2021

In this article we will see how we can use the generator to generate a CRUD based on our JHipster entities.

Four main parts :

  • Main features
  • Code organization
  • Using the generator
  • How it looks

Main features

The generator will create a CRUD based on the BLoC architecture (More info about this pattern). It will also create :

  • Routes
  • I18n fields (If activated)
  • Keys
  • Mapper declarations for Serialization / De-serialization
  • Add menu entries (Drawer)

For now, the generator handles 4 base field types :

  • String
  • Datetime
  • Enum
  • Boolean

Note : If you have DateTime in your entity, the state can’t be immutable meaning we can’t use the const keyword in the bloc state or in the form model because DateTime value can’t be computed at compile time.

Code organization

All entities code is generated in the entities package. we can divide it in two main parts.

  • The bloc part : Everything related to the state (events, form model, etc).
  • The UI part : where we have all the code related to the view (List view, edit view, update view, etc). We also have the repository to communicate with the API and the model.

Using the generator

You have two main ways to use it, you can be in the flutter-app folder in the jhispter project in that case the generator will automatically detect the entities folder, or you can be anywhere but you will have to specify the address of the jhipster project.

Only one

yo jhipster-flutter-merlin:entity Employee

All the entities

yo jhipster-flutter-merlin:entities

How it looks

If you are here it means that you’ve successfully generated your entities so you should have something like this :

Feel free to give me some feedback if you have trouble or if you find bugs. Feel also free to open a PR if you want to contribute.

Cheers !!

By the way, I’m launching a Spring boot / Angular Courses for beginners with coaching integrated, if you are interested click here

--

--

Cyril Casaucau

10 years of Fullstack dev / Freelance / Trainer #Angular #JHipster #Flutter #Java