Sosu Alfred
Sosu Alfred

Reputation: 456

Pattern to follow when developing apps with Flutter

I just stared developing mobile apps with Flutter. But, only one file is present. Hence, I would like to know if there is a particular paradigm to follow when creating the developer work-space.

Upvotes: 0

Views: 416

Answers (1)

Jack
Jack

Reputation: 1163

I've found that it highly depends on the state management solution you want to use. Each solution will warrant a different style/architecture. For instance, if you use the BLoC pattern, you might end up with a directory for each focus.

Something like:

  • authentication/
    • bloc.dart ("barrel" file - export all files below from here - one point of entry for imports)
    • authentication_bloc.dart
    • authentication_state.dart
    • authentication_event.dart
  • feature_one
    • bloc.dart ("barrel" file)
    • feature_one_bloc.dart
    • feature_one_state.dart
    • feature_one_event.dart
  • ui/utils/shared/etc (perhaps you split some other folders with shared services outside bloc related directories)

Once you find what state management solution you want to use, that'll help lead you on what paradigm you want to follow. From the way it seems right now in the Flutter community, there is no set way or standard yet. It's up to you to determine what's best for your project.

Upvotes: 3

Related Questions