select method

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 })

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.

The first argument in args must correspond to the choice Object.

Implementation

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);
}