const_date_time
1.2.1, released 2 years ago by westy92.com
A drop-in replacement for Dart's DateTime class with const constructors.
What it does
Provides a ConstDateTime class that acts as a drop-in replacement for Dart's built-in DateTime class, adding support for const constructors. It allows creating date and time instances at compile-time and includes an extension to convert regular DateTime objects to ConstDateTime.
AI-written summary of version 1.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to instantiate DateTime objects in const contexts
- You want to optimize performance by avoiding runtime allocations for constant dates
Skip it when
- You only need standard runtime DateTime manipulation
- You are looking for advanced date formatting or timezone handling libraries
Strengths
- Drop-in replacement for DateTime with identical API methods
- Enables const constructors for dates
- Zero external dependencies
Weaknesses
- Limited scope restricted entirely to mimicking DateTime with const support
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:const_date_time/const_date_time.dart';
final dateTime = const ConstDateTime(2022, 10, 27, 12, 34, 56, 789, 10);Alternatives
Packages that do the same job and could replace const_date_time.
- timezone
Time zone databases and time zone aware DateTime class in Dart.
94Compare - tempo
A time and date solution replacing core DateTime with advanced arithmetic and time zone support.
71Compare - sugar
Standard library extension for date-times, timezones, collections, and monads.
68Compare - wasm_ffi
Drop-in replacement for dart:ffi for WebAssembly on the web platform.
68Compare