flutter_fixer 0.3.0 copy "flutter_fixer: ^0.3.0" to clipboard
flutter_fixer: ^0.3.0 copied to clipboard

CLI to scan Flutter/Dart projects and run dart fix presets (const, print, super, imports, style); dry-run by default, interactive wizard without args.

flutter_fixer #

CLI for Flutter projects: summarize analyzer diagnostics and run dart fix only with an explicit --code whitelist defined in this package (const, avoid_print, super parameters, imports, style). It never runs unrestricted dart fix (no accidental “fix everything the analyzer knows”).

By default, fix only previews (dart fix --dry-run); use --apply to write changes. Even with --apply, only whitelisted diagnostic codes are passed to dart fix.

Requirements #

  • Dart SDK 3.5+ (dart analyze --format=json, dart fix --code=...).
  • A Flutter project (pubspec.yaml must list flutter under dependencies or dev_dependencies).

Install #

Add as a dev dependency in the app or package you want to scan/fix:

dev_dependencies:
  flutter_fixer: ^0.3.0

Then:

dart pub get

Usage #

Interactive (no arguments) #

From a terminal (TTY) in your project:

dart run flutter_fixer

You first choose language (default English on Enter): 1) English 2) Türkçe. Then scan or fix. For fix, options are numbered with all first (default: press Enter) — full whitelist; you can also type 0 for the same, or pick other groups (e.g. 2 4). Preview runs first, then you confirm dart fix --apply (still only whitelisted codes).

If stdin is not a TTY (e.g. CI), use the subcommands below instead.

Subcommands #

dart run flutter_fixer scan
dart run flutter_fixer fix              # preview only (dry-run)
dart run flutter_fixer fix --apply      # write fixes
dart run flutter_fixer fix --const --apply

Important: fix never applies changes unless you pass --apply. Preview first, commit or stash work before applying.

Selective fixes #

Category flags map to dart fix --code=... (combine as needed):

Flag Diagnostic codes
--all Full built-in whitelist (same as passing no category flags).
--const prefer_const_constructors, prefer_const_literals_to_create_immutables, prefer_const_declarations
--print avoid_print
--super use_super_parameters, use_key_in_widget_constructors
--import unused_import, unnecessary_import
--style unused_catch_stack, dead_null_aware_expression, duplicate_import, prefer_conditional_assignment, curly_braces_in_flow_control_structures, unnecessary_string_interpolations, unnecessary_brace_in_string_interps, prefer_interpolation_to_compose_strings, unnecessary_non_null_assertion

Examples:

dart run flutter_fixer fix --all
dart run flutter_fixer fix --const
dart run flutter_fixer fix --const --print --apply
dart run flutter_fixer fix --style --apply

With no category flags (or --all only), fix uses the full flutter_fixer whitelist, still dry-run until --apply.

Directory #

dart run flutter_fixer scan -C /path/to/my_app
dart run flutter_fixer fix --style --apply -C /path/to/my_app

Analysis options #

dart fix only fixes problems the analyzer reports. Enable the relevant lints in analysis_options.yaml (e.g. package:flutter_lints/flutter.yaml). See doc/recommended_analysis_options.yaml for a copy-paste snippet.

Publishing #

Replace repository / issue_tracker in pubspec.yaml with your real URLs before dart pub publish.

License #

MIT — see LICENSE.

1
likes
150
points
34
downloads

Documentation

API reference

Publisher

verified publishermuhammedfurkansahin.com.tr

Weekly Downloads

CLI to scan Flutter/Dart projects and run dart fix presets (const, print, super, imports, style); dry-run by default, interactive wizard without args.

Repository (GitHub)
View/report issues

Topics

#lint #cli #fix

License

MIT (license)

Dependencies

args, path, yaml

More

Packages that depend on flutter_fixer