lastEntry property

MapEntry<K, V>? get lastEntry

Returns the last key-value pair, or null if the map is empty.

Example:

{'a': 1, 'b': 2}.lastEntry; // MapEntry('b', 2)
{}.lastEntry; // null

Implementation

MapEntry<K, V>? get lastEntry {
  if (isEmpty) return null;
  return entries.last;
}