- Use
dart run slangto generate translations. - Use
dart run build_runner build --delete-conflicting-outputsto generate code.- Some errors may occur due to cached files, so use
dart run build_runner cleanto clean the cache if you encounter errors.
- Some errors may occur due to cached files, so use
- Generated files (
.g.dart,.freezed.dart) should not be committed manually - they are auto-generated.
- Title format:
<type>(<tag>): <title>. (tag is optional) - Always run
dart analyzebefore committing.
- Commit messages should be in the following format:
<type>(<tag>): <title>. (tag is optional)<type>is one of the following:feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)refactor: A code change that neither fixes a bug nor adds a featuretest: Adding missing tests or correcting existing testschore: Other changes that don't modify src or test filesci: Changes to CI configuration
<tag>is one of the following:chat: Chat related changesdeps: Dependency changesios: iOS related changesandroid: Android related changes
See README.md for more details.
- Use
BlocorCubitto manage state. - You can use
StatefulWidgetfor UI only state management (not related to the business logic). - Use
bloc_concurrencyto cancel, restart, drop, etc.- If event handler uses
emit.forEach, you should userestartable. - When multiple events can be invoked in the same time, but idempotence is guaranteed, you should use
droppable.
- If event handler uses
- Use
freezedto generate state and event classes.
-
Domain Layer is responsible for business logic.
-
It should not depend on any other layer.
-
Also, it should use only pure Dart code. No external dependencies or third-party libraries.
-
It is recommended to use
abstract interface classto define interfaces. -
It is recommended to use only getter and methods to define interfaces.
-
Define exception classes as
sealed classand useconst factoryto define exception classes. -
Errors from data layer should be rethrown as domain layer exceptions.
- Use
get_itandinjectableto manage dependencies. - Typically, use
@injectableto register dependencies. - Use
@singletonor@lazySingletonto register dependencies that are instantiated only once in the app.- For example,
AppRouter,dio,storage,loggeretc.
- For example,
- Data Layer implements domain layer.
- To inject data layer dependencies,
@Injectable(as: <interface>),@LazySingleton(as: <interface>)or@Singleton(as: <interface>)should be used.
- Do not use
Lclass by guessing.Luses predefined event names and properties. It must be used by humans.- Exceptionally,
L.ecan be used and should be used to log errors.
- Exceptionally,