locale_generator 1.1.0 copy "locale_generator: ^1.1.0" to clipboard
locale_generator: ^1.1.0 copied to clipboard

Generates dart code for locales

Dart package for generating localization files.

Features #

Generates dart code for dealing with locales.

Getting started #

Batteries included.

Usage #

Works just like freezed package:

  1. Define a class and a default constructor
  2. Generate mixin and a patch with @LocaleGen() annotation
  3. Mix in the mixin and redirect the default constructor
@LocaleGen()
@freezed
class SimplePageLocale with _$SimplePageLocale {
  const factory SimplePageLocale({
    required String title,
    required String subtitle,
  }) = _SimplePageLocale;

  factory SimplePageLocale.fromJson(Map<String, dynamic> json) =>
      _$SimplePageLocaleFromJson(json);
}

Additional information #

Contributions are welcome!