fl_core_third
A Flutter utility toolkit providing unified image loading (network/Asset/SVG), WebView, key-value storage (SharedPreferences/SecureStorage), date/number formatting, high-precision arithmetic, encryption, and more.
All public APIs are exported via
fl_core_third.dart. Import with:import 'package:fl_core_third/fl_core_third.dart';
Modules
1. App Initialization — FlThirdInit
Initialize paths, storage, device info, etc. Call early in main().
await FlThirdInit.init(); // Concurrent init of FlPath / FlSPUtils / FlFSUtils / FlDeviceInfoManager / FlPackageInfoManager
2. App Paths — FlPath
Cache and document directory paths via path_provider.
await FlPath.initPath();
print(FlPath.cacheDir); // e.g. /var/.../tmp/...
3. Lightweight Storage — FlSPUtils (SharedPreferences)
Type-safe key-value storage. Supports String, bool, int, double, List<String>, JSON Map.
await FlSPUtils.instance.init();
await FlSPUtils.instance.setString('token', 'abc123');
final token = await FlSPUtils.instance.getString('token');
4. Secure Storage — FlFSUtils (FlutterSecureStorage)
Encrypted storage (Android EncryptedSharedPreferences / iOS Keychain). Same API style as FlSPUtils.
await FlFSUtils.instance.init();
await FlFSUtils.instance.setString('token', 'xyz789');
5. Unified Storage — FlStore
Configurable global storage facade. Defaults to FlSPUtils, switchable to FlFSUtils or custom backends. Supports tag-based data isolation (e.g., per-user scoping).
await FlStore.instance.init();
FlStore.instance.tag = 'user_42';
await FlStore.instance.setString('name', 'Alice');
final keys = await FlStore.instance.getKeysForTag('user_42');
await FlStore.instance.clearByTag('user_42');
6. Device Info — FlDeviceInfoManager
Cross-platform device info (model, OS version, device type, fingerprint, etc.) via device_info_plus.
final info = await FlDeviceInfoManager.getDeviceInfo();
print(info.deviceModel); // "iPhone 15 Pro"
print(info.deviceType); // FlDeviceType.phone
7. Package Info — FlPackageInfoManager
App package info (name, version, build number, etc.) via package_info_plus.
final pkg = await FlPackageInfoManager.getPackageInfo();
print(pkg.version); // "1.2.3"
8. Device ID — FlDeviceIdManager
Persistent device identifier (Android ID / Keychain-stored UUID) that survives app reinstalls.
final deviceId = await FlDeviceIdManager.getDeviceId();
9. URL Launcher — FlUrlLauncherUtils
In-app WebView or external app URL launching via url_launcher.
final launcher = FlUrlLauncherUtils();
await launcher.launchInApp('https://example.com');
await launcher.launchInExternalApp('tel:10086');
10. Share — FlShareUtils
Share text, URIs, and files via share_plus.
FlShareUtils.share(text: 'Hello', subject: 'Greeting');
11. System Settings — FlSettingUtils
Jump to system settings pages (WiFi, Bluetooth, Notification, etc.) via app_settings.
await FlSettingUtils.openWifi();
await FlSettingUtils.openAppSettings();
12. High-Precision Arithmetic — FlDecimalUtils
Decimal arithmetic via the decimal package, avoiding floating-point precision issues.
FlDecimalUtils.add('0.1', '0.2'); // "0.3"
FlDecimalUtils.divide('10', '3', precision: 2); // "3.33"
13. Number Formatting — FlNumFormatUtils
Number formatting with 4 rounding modes: truncate, round, ceil, floor.
FlNumFormatUtils.formatWithSeparate('1234567.89'); // "1,234,567.89"
FlNumFormatUtils.formatPercent('0.1234'); // "12.34%"
FlNumFormatUtils.formatCompactNumber('1234567'); // "1.2M"
FlNumFormatUtils.formatCurrency('1234.56', symbol: '\$'); // "\$1,234.56"
14. Date/Time — FlDateTimeUtils
Date parsing, formatting, calculations, and queries via jiffy. Supports UTC mode via isUtc parameter.
FlDateTimeUtils.parse('2023-12-25');
FlDateTimeUtils.formatDate(DateTime.now(), format: 'yyyy-MM-dd');
FlDateTimeUtils.quarter('2023-12-25'); // 4
FlDateTimeUtils.formatDate(dt, format: 'HH:mm'); // format with pattern
15. Biometric Auth — FlLocalAuthUtils
Fingerprint, face, and iris authentication via local_auth.
final result = await FlLocalAuthUtils.authenticate(localizedReason: 'Verify identity');
if (result.isSuccess) { /* authenticated */ }
16. Encryption — FlCryptoUtils
Hashing (MD5, SHA-1/256/512), HMAC, Base64, hex encoding, constant-time comparison.
FlCryptoUtils.md5('hello'); // MD5 hash
FlCryptoUtils.hmac('secret', 'message'); // HMAC-SHA256
FlCryptoUtils.base64Encode('hello'); // "aGVsbG8="
FlCryptoUtils.secureCompare(hashA, hashB); // timing-safe compare
17. File Utils — FlFileUtils
File/directory operations: read, write, create, delete, cache management, size formatting.
FlFileUtils.formatSize(2048); // "2.00 KB"
await FlFileUtils.clearCacheDir();
18. Camera/Gallery — FlCameraPhotoUtils
Camera and photo library access via image_picker + permission_handler.
final photo = await FlCameraPhotoUtils.pickImageFromCamera();
final images = await FlCameraPhotoUtils.pickMultipleImages(limit: 9);
19. WebView — FlWebView
In-app WebView with URL, file, and HTML string loading via flutter_inappwebview.
FlWebView.url(urlStr: 'https://example.com');
FlWebView.html(html: '<h1>Hello</h1>', baseUrl: 'https://example.com');
20. WebView Manager — FlWebViewManager
Global WebView settings, cookie management, and cache clearing (singleton).
FlWebViewManager.instance.globalSetting.useWideViewPort = true;
await FlWebViewManager.instance.setCookie(url: uri, name: 'token', value: 'abc');
await FlWebViewManager.instance.clearWebCache();
21. Image Cache — FlImageCache
Disk + memory cache for network images via flutter_cache_manager.
FlImageCache.instance.getSizeStr(); // "1.23 MB"
await FlImageCache.instance.clear();
22. Unified Image View — FlImageView
Single widget for all image types: network, Asset, SVG (Asset/file/network/string).
FlImageView.network(imageUrl: 'https://example.com/img.png');
FlImageView.svgAsset(name: 'assets/icon.svg');
FlImageView.svgString(string: '<svg>...</svg>');
23. Extensions
The package provides convenient extensions on String and DateTime:
String extensions: .md5, .sha256, .base64Encode, .formatWithSeparator(), .formatPercent(), .toDecimal, .toDateTime(), etc.
DateTime extensions: .formatDate(format:), .quarter, .daysInMonth, .startOfDay, .endOfMonth, .isToday, .isLeapYear, .age, .ymd, .hms, etc.
Dependencies
| Package | Purpose |
|---|---|
android_id |
Android device ID |
app_settings |
System settings launcher |
cached_network_image |
Network image caching |
crypto |
Hashing / HMAC |
decimal |
High-precision arithmetic |
device_info_plus |
Device information |
flutter_cache_manager |
File cache management |
flutter_inappwebview |
In-app WebView |
flutter_secure_storage |
Encrypted storage |
flutter_svg |
SVG rendering |
image_picker |
Camera/gallery |
intl |
Internationalization / formatting |
jiffy |
Date/time parsing & formatting |
local_auth |
Biometric authentication |
meta |
Annotations |
package_info_plus |
App package info |
path |
Path joining |
path_provider |
System directory paths |
permission_handler |
Runtime permissions |
share_plus |
System share sheet |
shared_preferences |
Key-value storage |
url_launcher |
URL launching |
uuid |
UUID generation |
Libraries
- fl_core_third
- fl_core_third