reverse property

String? reverse

Returns the String reversed.

Example

String foo = 'Hello World';
String reversed = foo.reverse; // returns 'dlrow olleH'

Implementation

String? get reverse {
  if (this == null) return null;
  if (this!.isEmpty) return this;
  final letters = this!.split('').toList().reversed;
  return letters.reduce((current, next) => current + next);
}