Commonly used methods collection for android app.
- Get app information. Inspired by package_info_plus plugin. Just for Android.
- Get regional information for locales. Get country, language, currency, date & time formats, separators, measure system & more.
- π€ Android plugin stack
- π οΈ Installation
- ποΈοΈ Available methods
- π PackageInfo (usage ποΈβπ¨οΈ)
- π RegionalInfo (usage ποΈβπ¨οΈ)
- ποΈ Plugin Exceptions
- π¦ Changelog
βοΈ Help & Questions- π± Contributing
- MinSDK Android 5.0 (API level 21)
- Compiled with Android 15 (API level 35)
- Android NDK v27.0.12077973
- Kotlin v2.1.10
- Gradle v8.12.0 (Android Gradle Plugin v8.9.2)
- Java 17 major version
dependencies:
devdf_android: ^0.0.2
git:
url: git://github.com/devdfcom/android_plugin.gitCollection of all currently available methods, data classes, provided by the plugin.
This class provides information about the application package.
Class PackageInfo has the following properties:
app- Application name, fallback to package name if not availablepackage- Application package nameversion- Application version, fallback to empty string if not available ""build- Application build number, if not available, will be "0"
import 'package:devdf_android/devdf_android.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final PackageInfo? info = await PackageInfo.get();
print(info?.toString());
}This class provides information about the regional settings for the device or requested locale.
Class RegionalInfo has the following properties:
locale- The locale asStringrepresentation. Can containlanguage + "_" + country + "_" + ( variant + "_#" | "#") + script + "_" + extensionslanguage-StringISO 639 language code (e.g. "en", "ro", "fr")country-String?ISO 3166 2-letter code, or a UN M.49 3-digit code. (e.g. "US", "RO", "591" etc.)
firstDayOfWeek-intThe first day of the week, Starting from 1 (Sunday) to 7 (Saturday).timeFormat-intThe time format, where 0 = 12h, 1 = 24hdateShort-StringShort date format (yyyy-MM-dd)dateShorAlt-StringShort date format (dd/MM/yy)dateMedium-StringMedium date format (d MMM yyyy)dateMediumAlt-StringMedium date format (d MMMM yyyy)dateLong-StringLong date format (EEE, d MMM yyyy)dateLongAlt-StringLong date format (EEEE, d MMMM yyyy)
-
decimalSeparator-StringDecimal separator (e.g. ".") -
thousandSeparator-StringThousands separator (e.g. ",") -
currency-String?Currency ISO 4217 currency code (e.g. "USD", "EUR", "RON", "GBP", "JPY", etc.) -
currencySymbol-String?Currency symbol (e.g. "$", "β¬", "Β£", "Β₯", etc.) -
currencySymbolPosition-int?Currency symbol position, where 0 = before amount, 1 = after amount -
currencyFractionDigits-int?Currency fraction digits, The number of digits after the decimal separator. -
metricSystem-bool?Whether the locale uses a metric system or not.true- Metric system (e.g. "cm", "kg", "Β°C")false- Imperial system (e.g. "in", "lb", "Β°F")
import 'package:devdf_android/devdf_android.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
/// Get regional information for the current locale of the device
final RegionalInfo? info = await RegionalInfo.get();
/// OR get regional information for the requested locale.
/// locale example: "en_US", "ro-RO", "fr"
/// If `locale` has only language code (e.g. "en"), it will not provide full information,
/// info like country, currency, measure system, will be null.
final RegionalInfo? info = await RegionalInfo.get(locale: "en_US");
print(info?.toString());
}Plugin provides a set of exceptions that can be thrown during the plugin operation.
BaseException- Base exception for all exceptions.
Common exceptions for all channels:
AlreadyRunningExceptionThrown when the same method is already in progress.
Please see CHANGELOG.md for more information on what has changed recently.
Start a new discussion in the Discussions Tab.
Any contributions you make are greatly appreciated.
Just fork the repository and create a pull request.
For major changes, please first start a discussion in the Discussions Tab to discuss what you would like to change.
Note
By submitting a patch, you agree to allow the project owner(s) to license your work under the terms of
the MIT License.
π Thank you!