Skip to content

Latest commit

 

History

History
198 lines (131 loc) · 6.99 KB

File metadata and controls

198 lines (131 loc) · 6.99 KB

Android plugin (devdf_android)

devdf_android

License: MIT Request a feature Ask a question Report a bug

Commonly used methods collection for android app.

🚀 Features

  • 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.

📖 Documentation

Table of Contents:

  1. 🤖 Android plugin stack
  2. 🛠️ Installation
  3. 🗂️️ Available methods
  4. 🗃️ Plugin Exceptions
  5. 📦 Changelog
  6. ⁉️ Help & Questions
  7. 🌱 Contributing

🤖 Android plugin stack

  • 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

🛠️ Installation

dependencies:
  devdf_android: ^0.0.2
  git:
    url: git://github.com/devdfcom/android_plugin.git

🗂️ Available methods, data classes

Collection of all currently available methods, data classes, provided by the plugin.

📄 PackageInfo

This class provides information about the application package.

Class PackageInfo has the following properties:

  • app - Application name, fallback to package name if not available
  • package - Application package name
  • version - Application version, fallback to empty string if not available ""
  • build - Application build number, if not available, will be "0"

PackageInfo Usage:

import 'package:devdf_android/devdf_android.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  final PackageInfo? info = await PackageInfo.get();
  print(info?.toString());
}

📄 RegionalInfo

This class provides information about the regional settings for the device or requested locale.

Class RegionalInfo has the following properties:

Locale, language, country properties:

  • locale - The locale as String representation. Can contain language + "_" + country + "_" + ( variant + "_#" | "#") + script + "_" + extensions
  • language - String ISO 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.)

Date & Time format, first day of the week:

  • firstDayOfWeek - int The first day of the week, Starting from 1 (Sunday) to 7 (Saturday).
  • timeFormat - int The time format, where 0 = 12h, 1 = 24h
  • dateShort - String Short date format (yyyy-MM-dd)
  • dateShorAlt - String Short date format (dd/MM/yy)
  • dateMedium - String Medium date format (d MMM yyyy)
  • dateMediumAlt - String Medium date format (d MMMM yyyy)
  • dateLong - String Long date format (EEE, d MMM yyyy)
  • dateLongAlt - String Long date format (EEEE, d MMMM yyyy)

Currency, measure system, separators:

  • decimalSeparator - String Decimal separator (e.g. ".")

  • thousandSeparator - String Thousands 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")

RegionalInfo Usage:

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 Exceptions

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:

  • AlreadyRunningException Thrown when the same method is already in progress.

📦 Changelog

Please see CHANGELOG.md for more information on what has changed recently.

⁉️ Help & Questions

Start a new discussion in the Discussions Tab.

🌱 Contributing

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!