Jiffy.parseFromMap constructor

Jiffy.parseFromMap(
  1. Map<Unit, int> map, {
  2. bool isUtc = false,
})

Constructs a Jiffy instance from a map of date and time values.

The map parameter should be a map of Unit values to integer values. The Unit enum specifies the different date and time units that can be provided in the map, including year, month, day, hour, minute, second, millisecond, and microsecond.

If any of the other keys ('UNIT.YEAR', 'UNIT.MONTH', 'UNIT.DAY', 'UNIT.HOUR', 'UNIT.MINUTE', 'UNIT.SECOND', 'UNIT.MILLISECOND', 'UNIT.MICROSECOND') are not provided, they default to the current date time value.

Example usage:

final jiffy = Jiffy.parseFromMap(
  {
    Unit.YEAR: 1997,
    Unit.MONTH: 9,
    Unit.DAY: 23,
  }
);

Throws a JiffyException if the input map is empty.

Implementation

factory Jiffy.parseFromMap(Map<Unit, int> map, {bool isUtc = false}) {
  return Jiffy._internal(map, isUtc: isUtc);
}