Is there a best practice for the location of custom helper classes in Flutter using BLoC architecture?
This is my package structure:
/data
/data_providers
/models
/repositories
/logic
/blocs
/cubits
/presentation
/screens
/widgets
/resources
Example: I have a custom helper class Tuple
which is only used in my model /data/models/User.dart
.
I see the following options:
Tuple
above or below class User
in /data/models/User.dart
/data/models/Tuple.dart
and place class Tuple
there/helpers
in the root directory, create the file /helpers/Tuple.dart
and place class Tuple
thereOf course all solutions are functionable. The question is: What is best practice?
Indeed there is no standard best practice to put it. In my own opinion, create a separate folder called utils
or util
or helper
or helpers
and put it there. This is reasonable, since helpers are themselves not a model (so may not be put into models/*.dart
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With