Skip to content

[gen-l10n] Synthetic package resolution not working properly with plugins #70840

@zackattack73

Description

@zackattack73

I have create a Flutter Plugin and want to add Internationalization following the documentation.
Everything is working perfectly for a Flutter app but not for a plugin.

While launching the example in the plugin, it seems like the plugin can't find the generated file
Error: Could not resolve the package 'flutter_gen' in 'package:flutter_gen/gen_l10n/translations.dart'. ../lib/PluginName.dart:9:8: Error: Not found: 'package:flutter_gen/gen_l10n/translations.dart' import 'package:flutter_gen/gen_l10n/translations.dart';

My l10n.yaml configuration file is :

arb-dir: assets/l10n
template-arb-file: string_en.arb
output-localization-file: translations.dart
output-class: Translations

I did a flutter clean, flutter pub get and my IDE weems to find the 'package:flutter_gen/gen_l10n/translations.dart' and don't display any error when using

Translations.of(context).title;

But I can't find a way to launch the example without having the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: internationalizationSupporting other languages or locales. (aka i18n)toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions