shorthand_sanitizer 0.8.1
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.
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.