This extension provides a way to access the UNIX time (seconds)
With Dart:
$ dart pub add unixtimeWith Flutter:
$ flutter pub add unixtimeImport
import 'package:unixtime/unixtime.dart';To get the DateTime from UNIX time.
final datetime = 1669361095.toUnixTime();
// => 2022-11-25 16:24:55.000You can create a UTC timezone with isUtc option.
final datetime = 1669361095.toUnixTime(isUtc: true);
// => 2022-11-25 07:24:55.000ZTo get UNIX timestamp from DateTime.
DateTime.now().unixtime
// => 1669361095