unshiftByKind method

Map<String, int> unshiftByKind(
  1. String kind, [
  2. ShiftType type = ShiftType.increment
])

Implementation

Map<String, int> unshiftByKind(String kind,
    [ShiftType type = ShiftType.increment]) {
  Map<String, int>? result;
  result = this;
  final reactionCountsByKind = result?[kind] ?? 0;
  if (result != null) {
    result = {
      ...result,
      kind: reactionCountsByKind.unshift(type)
    }; //+1 if increment else -1
  } else {
    if (type == ShiftType.increment) {
      result = {kind: 1};
    } else {
      result = {kind: 0};
    }
  }
  return result;
}