GithubHelp home page GithubHelp logo

snackngoctam / package_info_plus Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 278 KB

License: BSD 3-Clause "New" or "Revised" License

Kotlin 6.55% Java 1.30% Dart 43.75% Swift 1.75% Objective-C 4.34% CMake 17.37% C++ 20.97% C 0.85% HTML 1.23% Ruby 1.90%

package_info_plus's Introduction

package_info_plus

Flutter Community: package_info_plus

package_info_plus pub points pub package

build

This Flutter plugin provides an API for querying information about an application package.

Platform Support

Android iOS MacOS Web Linux Windows

Usage

You can use the PackageInfo to query information about the application package. This works both on iOS and Android.

import 'package:package_info_plus/package_info_plus.dart';

...

// Be sure to add this line if `PackageInfo.fromPlatform()` is called before runApp()
WidgetsFlutterBinding.ensureInitialized();

...

PackageInfo packageInfo = await PackageInfo.fromPlatform();

String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;

Known Issues

iOS

Plugin returns incorrect app version

Flutter build tools allow only digits and . (dot) symbols to be used in version of pubspec.yaml on iOS/MacOS to comply with official version format from Apple.

More info available in this comment

I have changed version in pubspec.yaml and plugin returns wrong info

As noted on issue 20761, package_info_plus on iOS requires the Xcode build folder to be rebuilt after changes to the version string in pubspec.yaml. Clean the Xcode build folder with: XCode Menu -> Product -> (Holding Option Key) Clean build folder.

Android (and potentially all platforms)

Calling to PackageInfo.fromPlatform() before the runApp() call will cause an exception. See fluttercommunity/plus_plugins#309

Windows

I see wrong version on Windows platform

There was an issue in Flutter, which is already resolved since Flutter 3.3. If your project was created before Flutter 3.3 you need to migrate the project according to [this guide] (https://docs.flutter.dev/release/breaking-changes/windows-version-information) first to get correct version with package_info_plus

Learn more

package_info_plus's People

Contributors

snackngoctam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.