Skip to content
pubscout

dot_shorthand_converter

0.0.4, released a year ago by an unverified publisher

A CLI and library to refactor Flutter enum usages into dot-shorthand form.

WASM-ready
$ flutter pub add dot_shorthand_converter
Source repository

What it does

It automatically refactors common Flutter enum usages like MainAxisAlignment.start into the new dot-shorthand form (.start). It can be run as a CLI command or used programmatically as a library.

AI-written summary of version 0.0.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to modernize a Flutter codebase to use the new dot-shorthand enum syntax.
  • You need a quick way to batch-replace 100+ common Flutter enums across your files.

Skip it when

  • You require an AST-based analyzer for precise type checking before transforming code.
  • You are working with custom enums that are not matched by regex and you don't want to specify them manually.

Strengths

  • Supports 100+ common Flutter enums out of the box.
  • Zero dependencies and fast text-based transformation.
  • Can be used both as a CLI tool and programmatically as a library.

Weaknesses

  • Text-based transformer rather than a full AST analyzer, which may be aggressive in unusual contexts.
  • May require manual review of the diff to ensure safety.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Add dot_shorthand_converter to your dev_dependencies in pubspec.yaml and run dart pub get.

import 'package:dot_shorthand_converter/dot_shorthand_converter.dart';

void main() {
  const before = 'mainAxisAlignment: MainAxisAlignment.start,';
  final after = convertToDotShorthand(before);
  print(after); // 'mainAxisAlignment: .start,'
}

Alternatives

Packages that do the same job and could replace dot_shorthand_converter.

  • umeng_common_sdk

    Umeng Common SDK plugin for Flutter, providing analytics and push support on Android, iOS and HarmonyOS.