initials property Null safety

String initials

convert to initials: Foo Bar -> FB, or an empty string if this is blank

Implementation

String get initials => this.isBlank
    ? ''
    : this!.splitMapJoin(RegExp(r'\s+'),
        onMatch: (m) => '',
        onNonMatch: (n) => n.isEmpty ? '' : n[0].toUpperCase());