splitOnFirst function

List<String?> splitOnFirst(
  1. String? s,
  2. String c
)

Implementation

List<String?> splitOnFirst(String? s, String c) {
  if (s == null || s == "") return [s];
  var pos = s.indexOf(c);
  return pos >= 0 ? [s.substring(0, pos), s.substring(pos + 1)] : [s];
}