yearlyKey function

String yearlyKey(
  1. String key,
  2. [DateTime? time]
)

Gets the key for the year associated with key.

If time is specified, the key at that time is obtained.

Implementation

String yearlyKey(String key, [DateTime? time]) {
  time ??= DateTime.now();
  return "$key:${time.format("yyyy")}";
}