sheetify_lint 1.0.1
sheetify_lint: ^1.0.1 copied to clipboard
A custom lint package for Flutter projects using Sheetify.
Sheetify Lint #
sheetify_lint is a companion linter package for Sheetify that helps enforce best practices and prevent common mistakes when using advanced delegate-based bottom sheets.
🎯 Purpose #
This package is built on top of custom_lint and provides custom lint rules tailored specifically for the Sheetify package. It helps ensure that certain constructs are used correctly to avoid unnecessary rebuilds and layout issues.
📦 Installation #
Add both custom_lint and sheetify_lint as dev dependencies in your app:
dev_dependencies:
custom_lint: ^0.8.0
sheetify_lint: ^1.0.1
Enable the linter plugin in your analysis_options.yaml:
analyzer:
plugins:
- custom_lint
Now, any violations will appear in your IDE or CLI output.
If no lint warnings are shown, you can manually run dart run custom_lint to verify that the plugin is functioning
Included Lint Rules #
❌ Avoid constructing delegates in build() methods #
Constructing StatefulSheetDelegate.func() or ToggleSheetDelegate.func() inside a build() method can lead to performance issues due to unnecessary widget rebuilds and inconsistent animation behavior.
✅ Instead:
Create these delegates once as final fields in the widget’s State class or pass them via constructor.
// Good: declared outside build()
final barrierColorDelegate = ToggleSheetDelegate.func(...);
// Bad: inside build() method
ToggleSheetDelegate.func(...)
🤝 Contributing #
Feel free to contribute or suggest additional rules!
Open a PR or issue with:
- A clear description of your use case.
- A working code example with expected/actual behavior.
- A test case, if submitting a new rule.
📜 License #
BSD-2 License. See LICENSE for details.