dartnative_intl
ARB-to-Dart localisation code generator for DartNative apps — a drop-in replacement for
intl_utils. One command, same config, generated code that's pure DartNative.
Why you'll like it
- Pure DartNative output — generated files import
dartnative; your l10n layer has no external SDK dependency. - Same config — the
flutter_intl:block inpubspec.yamlworks exactly as withintl_utils; nothing to learn. - Same generated API —
S.of(context),S.delegate, andS.supportedLocalesare identical; existing app code needs no changes beyond swapping the dependency. - Familiar —
dart run dartnative_intl:generate, likeintl_utils.
Highlights
dart run dartnative_intl:generate— reads your ARB files and generates the full l10n class tree.Locale,LocalizationsDelegate,Localizations— pure-Dart runtime shims included so generated code compiles with no extra dependencies.- Localizely support — optional download step pulls ARBs from Localizely before generating (same as upstream).
Install
dependencies:
dartnative_intl: ^1.0.0 # from dartpub.dev
dn pub get
Configure in pubspec.yaml (same keys as intl_utils):
flutter_intl:
enabled: true
arb_dir: lib/l10n
output_dir: lib/generated
main_locale: en
Quick look
Add your ARB files:
lib/l10n/intl_en.arb
lib/l10n/intl_pt.arb
Run the generator:
dart run dartnative_intl:generate
Use the generated class in your app:
import 'package:dartnative_intl/dartnative_intl.dart';
// Register the resolver once at startup
Localizations.setResolver(<T>(context) => /* your dartnative lookup */);
// Then anywhere in your widget tree
final label = S.of(context).welcomeMessage;
Wire up the delegate (identical to intl_utils):
localizationsDelegates: [
S.delegate,
...
],
supportedLocales: S.supportedLocales,
Credits & license
Adapted from
intl_utils
(MIT), reworked to use DartNative imports.
Distributed via dartpub.dev — file issues on the plugin's page.