formatWith method

String formatWith(
  1. BuildContext context, {
  2. int maxParts = 2,
  3. int secondsToShowNow = 0,
})

Localize duration using TranslatedDurationFormatter formatter You have to add TranslatedDurationFormatter.delegate in your localizationsDelegates

return MaterialApp(
  localizationsDelegates: [
    TranslatedDurationFormatter.delegate,
    ...other delegates
  ],
  home: MyApplicationHome(),
);

Implementation

String formatWith(
  BuildContext context, {
  int maxParts = 2,
  int secondsToShowNow = 0,
}) {
  var simpleLocalization = ReadyExtensionLocalizations.of(context);
  if (simpleLocalization == null) {
    throw FlutterError(
        'You have to add `SimpleLocalizations.delegate` in your `localizationsDelegates`');
  }
  return format(
    maxParts: maxParts,
    secondsToShowNow: 0,
    formatter: TranslatedDurationFormatter.of(context),
  );
}