Getting Started
Native Flutter i18n with the better_i18n Dart SDK — CDN-driven translations with offline support.
Overview
better_i18n is a pure Dart + Flutter SDK that loads translations from the better-i18n CDN at runtime. It uses the same CDN infrastructure as the Expo and iOS SDKs — meaning your translations are managed in one place and delivered to all platforms.
- CDN-driven — Translations update without app store releases
- Offline-first — 4-tier fallback: memory → CDN → persistent storage → static data
- Reactive UI —
BetterI18nProviderrebuilds widgets automatically on locale change - No codegen — No build steps, no generated files, no native modules
BetterI18nProvider handles everything — CDN fetch, caching, locale switching, and loading/error states. Use context.t('key') anywhere in the widget tree.
Features
Offline-First
4-tier fallback chain ensures translations are always available — even without network.
Reactive UI
Locale switches rebuild the widget tree instantly via ChangeNotifier.
Locale Switching
context.setI18nLocale('tr') — pre-loads translations before switching.
Testing Utilities
MemoryStorage and BetterI18nScope make widget testing straightforward.
No Codegen
Pure Dart — no build_runner, no generated files, no native modules required.
Quick Start
dependencies:
better_i18n: ^0.1.0import 'package:better_i18n/better_i18n.dart';
import 'package:flutter/material.dart';
void main() {
runApp(
BetterI18nProvider(
project: 'your-org/your-project',
defaultLocale: 'en',
child: const MyApp(),
),
);
}import 'package:better_i18n/better_i18n.dart';
import 'package:flutter/material.dart';
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(context.t('common.welcome')),
Text(context.t('common.greeting', args: {'name': 'Osman'})),
],
),
),
);
}
}Guide
Setup
Installation, configuration, and locale switching.
Offline & Caching
How the 4-tier fallback chain and persistent storage work.
API Reference
Complete API documentation for all exports.
Comparison
| Feature | Flutter | Expo | iOS |
|---|---|---|---|
| Language | Dart | TypeScript | Swift |
| i18n library | better_i18n | i18next | better-i18n-ios |
| UI framework | Flutter widgets | React Native | SwiftUI / UIKit |
| Offline support | Built-in | Built-in | Built-in |
| Reactive rebuilds | ChangeNotifier | React state | @Observable / ObservableObject |
| Persistent cache | SharedPrefsStorage | MMKV / AsyncStorage | UserDefaults |
| No codegen | Yes | Yes | Yes |
Choose Flutter for cross-platform mobile apps written in Dart. For React Native / Expo apps, see Expo. For native iOS, see iOS.