I18n constructor

I18n({
  1. Key? key,
  2. String? id,
  3. required Widget child,
  4. Locale? initialLocale,
})

The I18n widget should wrap the child which contains the tree of widgets you want to translate. If you want, you may provide an initialLocale. You may also provide a key, or, for advanced uses, an id which you can use with the forceRebuild function.

Implementation

I18n({
  Key? key,
  String? id,
  required this.child,
  this.initialLocale,
}) : super(key: key ?? ((id != null && id.isNotEmpty) ? GlobalObjectKey<_I18nState>(id) : null));