getOrdinalRules function

String? getOrdinalRules(
  1. int number,
  2. String? localeCode
)

Implementation

String? getOrdinalRules(int number, String? localeCode) {
  if (localeCode == null) {
    return null;
  }
  final ordinalFormatter = js.JsObject(
    js.context['Intl']['PluralRules'],
    [
      localeCode,
      js.JsObject.jsify({'type': 'ordinal'}),
    ],
  );

  final ordinalRules = ordinalFormatter.callMethod('select', [number]);

  return ordinalRules;
}