select static method

String select(
  1. Object choice,
  2. Map<Object, String> cases,
  3. {String? desc,
  4. Map<String, Object>? examples,
  5. String? locale,
  6. String? name,
  7. List<Object>? args,
  8. String? meaning,
  9. bool? skip}
)

Format a message differently depending on choice.

We look up the value of choice in cases and return the result, or an empty string if it is not found. Normally used as part of an Intl.message message that is to be translated.

It is possible to use a Dart enum as the choice and as the key in cases, but note that we will process this by truncating toString() of the enum and using just the name part. We will do this for any class or strings that are passed, since we can't actually identify if something is an enum or not.

Implementation

@pragma('dart2js:tryInline')
@pragma('vm:prefer-inline')
static String select(Object choice, Map<Object, String> cases,
    {String? desc,
    Map<String, Object>? examples,
    String? locale,
    String? name,
    List<Object>? args,
    String? meaning,
    bool? skip}) {
  return _select(choice, cases,
      locale: locale, name: name, args: args, meaning: meaning);
}