firstOrNull property

String? firstOrNull
  • return the first character
  • return null if isEmpty

Implementation

String? get firstOrNull => isEmpty ? null : this[0];