build method

  1. @override
StringOrFormat build(
  1. dynamic args
)
override

Implementation

@override
StringOrFormat build(dynamic args) {
  if (builder == null) {
    throw Exception(
      'You cannot call build method on this DataSource since no builder was provided in this DataSource '
      'with DataKey=$dataKey',
    );
  }

  final result = builder!(args, locale);

  if (result is StringOrFormat) {
    if (result.isFormat) {
      return StringOrFormat.format(result.format);
    } else {
      return StringOrFormat.string(result.string);
    }
  } else if (result is Format) {
    return StringOrFormat.format(result);
  } else {
    return StringOrFormat.string(result.toString());
  }
}