---
title: "flutter"
description: "The preset for flutter_i18n. It reads JSON and YAML assets, FlutterI18n.translate and the I18nText widgets in Dart."
canonical_url: "https://x18n.dev/presets/flutter"
---
# flutter

> The preset for flutter_i18n. It reads JSON and YAML assets, FlutterI18n.translate and the I18nText widgets in Dart.

The `flutter` preset supports [flutter_i18n](https://pub.dev/packages/flutter_i18n).

## Detection

The preset applies when `pubspec.yaml` has the dependency `flutter_i18n`.

```ts [x18n.config.ts]
import { defineConfig } from '@x18n/core'

export default defineConfig({
  presets: ['flutter'],
})
```

## Locale files

If your config has no `resources`, the preset uses `assets/flutter_i18n/{locale}.{ext}` and `assets/i18n/{locale}.{ext}`.

## Supported syntax

In Dart files, the preset reads `FlutterI18n.translate`, `FlutterI18n.plural`, `I18nText` and `I18nPlural`:

```dart [lib/main.dart]
Text(FlutterI18n.translate(context, "title"));
I18nText("greet");
```

These usages are `title` and `greet`.

## Placeholders

Braces: `{name}`.

## Extraction templates

| Kinds | Template                                  |
| ----- | ----------------------------------------- |
| any   | `FlutterI18n.translate(context, '{key}')` |


## Sitemap

See the full [sitemap](https://x18n.dev/sitemap.md) for all pages.
