⌨️Code Conventions
Variables
In the AppFlowy codebase, we prioritise variable immutability and consistency. This approach is integral to our code conventions, enhancing code quality and maintainability.
As much as you can, prefer declaring variables as immutable. This is done in Flutter by the use of the `final` keyword, and in Rust by omitting the `mut` keyword.
In the case you prefer specifying the type of immutable variables, please do this consistently throughout your code. For immutable variables, always specify the type.
By adhering to these principles, we create a codebase that is not only functional but also comprehensible and maintainable for all team members.
Use Cascade Notation
Cascade notation allows you to perform a sequence of operations on the same object. It saves your number of steps and needs for a temporary variable.
Flutter
Rust
Use expression bodies
For functions that contain just one expression, you can use an expression function. The =>
(arrow) notation is used for expression functions.
Flutter
Rust
Inline TODOs
We prefer not including inline todos in the codebase, however, whilst you're developing feel free to add TODOs.
When opening a PR, please try to resolve the TODOs you created, if they need more attention or are more complex, then you can remove the TODO in favor of opening an issue on Github.
Dependencies and Crates
Last updated