lastOrNull property

String? lastOrNull
  • return the last character
  • return null if isEmpty

Implementation

String? get lastOrNull => isEmpty ? null : this[length - 1];