system_date_time_format 0.6.0 system_date_time_format: ^0.6.0 copied to clipboard
A plugin for getting date and time format patterns from device system settings.
0.6.0 #
- Introduced
SDTFScope
widget:
void main() {
runApp(const SDTFScope(child: App()));
}
class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
final patterns = SystemDateTimeFormat.of(context);
final datePattern = patterns.datePattern;
final mediumDatePattern = patterns.mediumDatePattern;
final longDatePattern = patterns.longDatePattern;
final timePattern = patterns.timePattern;
print(datePattern); // e.g. "M/d/yy"
print(mediumDatePattern); // e.g. "MMM d,y"
print(longDatePattern); // e.g. "MMMM d,y"
print(timePattern); // e.g. "HH:mm"
}
}
- Introduced raw async getters:
final format = SystemDateTimeFormat();
final datePattern = await format.getDatePattern();
final mediumDatePattern = await format.getMediumDatePattern();
final longDatePattern = await format.getLongDatePattern();
final timePattern = await format.getTimePattern();
print(datePattern); // e.g. "M/d/yy"
print(mediumDatePattern); // e.g. "MMM d,y"
print(longDatePattern); // e.g. "MMMM d,y"
print(timePattern); // e.g. "HH:mm"
Warning
Deprecated
initialize
method -> useSDTFScope
insteadDeprecated
dateFormat
getter -> usegetDatePattern()
insteadDeprecated
mediumDateFormat
getter -> usegetMediumDatePattern()
insteadDeprecated
longDateFormat
getter -> usegetLongDatePattern()
insteadDeprecated
timeFormat
getter -> usegetTimePattern()
instead
0.5.0 #
Added linux support
0.4.1 #
- Fixed library names conflict
- Improved documentation
0.4.0 #
Added web support
0.3.0 #
Added windows support
0.2.0 #
Added macOS support
0.1.1 #
- Formatted code
- Updated screenshots
- Improved README
0.1.0 #
Initial release 🎉