system_date_time_format
1.5.1, released 4 months ago by dominikkrajcer.com
Get date and time format patterns from device system settings.
What it does
A Flutter plugin that retrieves date and time format patterns from the user's device system settings. It helps provide consistent, localized date and time formats that respect user preferences, and includes a widget scope to automatically sync patterns if the user changes settings while the app is running.
AI-written summary of version 1.5.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need your app's date and time formatting to match the user's device system preferences
- You want to react dynamically when a user changes their date and time system settings while the app is running
Skip it when
- You prefer to enforce a single hardcoded date and time format across all users and regions
- You are running on platforms or configurations where system pattern retrieval is unsupported or unnecessary
Strengths
- Supports multiple platforms including Android, iOS, web, Windows, macOS, and Linux
- Includes SDTFScope for automatic syncing of patterns when device settings change
- Provides WASM compatibility and Swift Package Manager support
Weaknesses
- Certain pattern getters like medium and full date patterns are not supported on Windows and Linux
- Requires adding a manual script tag to index.html for web support
Setup
- Kind
- Plugin (native code)
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
For web applications, you must include the system_date_time_format.js script in your index.html file.
import 'package:system_date_time_format/system_date_time_format.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final format = SystemDateTimeFormat();
final datePattern = await format.getDatePattern();
print(datePattern);
}Alternatives
Packages that do the same job and could replace system_date_time_format.
- region_settings
Get device region settings like measurement system, temperature units, and date/number formats.
59Compare - shamsi_date
A Dart and Flutter package for using, converting, and formatting Jalali and Gregorian calendars.
63Compare - locale_plus
Access native device locale data like language, country code, time zone, and number formats.
60Compare - world_info_plus
Detailed information about 250 countries including dial codes, time zones, and localized names.
45Compare
Works with
Packages commonly used together with system_date_time_format: ones it builds on, ones built on it, and its own family.