flutter_design_guard 0.1.1 copy "flutter_design_guard: ^0.1.1" to clipboard
flutter_design_guard: ^0.1.1 copied to clipboard

Official Dart Analysis Server plugin for enforcing Flutter design-system rules. Configure it through analysis_options.yaml.

Flutter Design Guard #

A Dart Analysis Server plugin that helps enforce your Flutter design system by reporting the usage of forbidden Flutter widgets and suggesting your project's custom replacements.

Features #

  • ✅ Detects direct usage of TextField
  • ✅ Detects direct usage of TextFormField
  • ✅ Supports configurable replacement widgets
  • ✅ Supports allowing implementation files
  • ✅ Runs automatically during dart analyze and flutter analyze

Requirements #

  • Flutter 3.38.0 or later
  • Dart 3.10.0 or later

Installation #

Flutter Design Guard uses the official Dart Analyzer Plugin system.

Enable the plugin in your analysis_options.yaml:

plugins:
  flutter_design_guard: ^0.1.1

No changes to pubspec.yaml are required.

Configuration #

Create a file named:

flutter_design_guard.yaml

Example:

rules:
  avoid_native_text_field:
    replacement: CustomTextField
    implementation_paths:
      - lib/core/widgets/custom_text_field.dart

replacement #

The widget that should be used instead of Flutter's native text fields.

implementation_paths #

Project-relative paths where native TextField and TextFormField usage is allowed. This is typically the implementation file of your custom wrapper widget.

Example #

❌ Bad #

TextField();

TextFormField();

✅ Good #

CustomTextField(
  controller: controller,
);

Diagnostic #

Using TextField or TextFormField produces:

warning • Do not use TextField directly. Use CustomTextField instead. • avoid_native_text_field

Supported Commands #

The plugin runs automatically with:

flutter analyze

or

dart analyze

License #

MIT

4
likes
160
points
336
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Official Dart Analysis Server plugin for enforcing Flutter design-system rules. Configure it through analysis_options.yaml.

Repository (GitHub)
View/report issues

Topics

#analyzer #flutter #lints #static-analysis #code-quality

License

BSD-3-Clause (license)

Dependencies

analysis_server_plugin, analyzer, analyzer_plugin, yaml

More

Packages that depend on flutter_design_guard