shorthand_sanitizer 0.8.1 copy "shorthand_sanitizer: ^0.8.1" to clipboard
shorthand_sanitizer: ^0.8.1 copied to clipboard

Batch codemod for Dart 3.10 dot shorthands — rewrites Type.member to .member only where the analyzer proves it a no-op, prunes imports it orphans. Ships the dotsan CLI.

example/example.md

dart pub global activate shorthand_sanitizer

dotsan                          # sanitize every existing root dir (lib, bin, test, ...)
dotsan lib test --dry-run       # report only
dotsan --skip=AsyncValue.error  # keep listed members prefixed

Before:

await SystemChrome.setPreferredOrientations([
  DeviceOrientation.portraitUp,
  DeviceOrientation.portraitDown,
]);

return Text(
  label,
  textAlign: TextAlign.center,
  overflow: TextOverflow.ellipsis,
);

After dotsan lib && dart format lib:

await SystemChrome.setPreferredOrientations([.portraitUp, .portraitDown]);

return Text(label, textAlign: .center, overflow: .ellipsis);

dotsan rewrites the prefixes; dart format then reflows what fits in 80 columns, which is where the line reduction comes from.

2
likes
150
points
275
downloads

Documentation

API reference

Publisher

verified publishermehmetesen.com

Weekly Downloads

Batch codemod for Dart 3.10 dot shorthands — rewrites Type.member to .member only where the analyzer proves it a no-op, prunes imports it orphans. Ships the dotsan CLI.

Homepage
Repository (GitHub)
View/report issues

Topics

#analyzer #code-style #static-analysis #cli #developer-tools

License

MIT (license)

Dependencies

analyzer, args, cli_util, glob, path

More

Packages that depend on shorthand_sanitizer