selectLogic method

dynamic selectLogic (Object choice, Map<String, dynamic> cases)

Internal: Implements the logic for select - use select for normal messages.

Implementation

static selectLogic(Object choice, Map<String, dynamic> cases) {
  // Allow passing non-strings, e.g. enums to a select.
  choice = "$choice";
  var exact = cases[choice];
  if (exact != null) return exact;
  var other = cases["other"];
  if (other == null)
    throw new ArgumentError("The 'other' case must be specified");
  return other;
}