createFakeValueFromFormat function

String createFakeValueFromFormat(
  1. Format format,
  2. FakerXLocale locale,
  3. ProvideContext context
)

Implementation

String createFakeValueFromFormat(
  Format format,
  FakerXLocale locale,
  ProvideContext context,
) {
  final keys = format.keys;

  final providedValues = keys.map((e) {
    final newContext =
        ProvideContext(dataKey: e, locale: locale, previousContext: context);
    return provide(e, locale, context: newContext) as String;
  }).toList();

  return format.parse(providedValues);
}