All Projects → fluttercommunity → get_version

fluttercommunity / get_version

Licence: MIT license
Get Version - Get the Version Name, Version Code, Platform and OS Version, and App ID on iOS and Android. Maintainer: @rodydavis

Programming Languages

dart
5743 projects
ruby
36898 projects - #4 most used programming language
swift
15916 projects
kotlin
9241 projects
HTML
75241 projects
shell
77523 projects
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to get version

Flutter-Mobile-Number-Plugin
Flutter Plugin to get the mobile number
Stars: ✭ 22 (-74.71%)
Mutual labels:  flutter-plugin
gbk2utf8
A flutter package to convert gbk to utf-8
Stars: ✭ 40 (-54.02%)
Mutual labels:  flutter-plugin
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+58.62%)
Mutual labels:  flutter-plugin
flutter contest
Flutter project submitted on Flutter contest
Stars: ✭ 14 (-83.91%)
Mutual labels:  flutter-plugin
stop watch timer
This is Stop Watch Timer for flutter plugin.🏃‍♂️
Stars: ✭ 76 (-12.64%)
Mutual labels:  flutter-plugin
Some-Calendar
Custom calendar dialog widget for flutter with (multi select, single select, date range) mode
Stars: ✭ 69 (-20.69%)
Mutual labels:  flutter-plugin
flutter ume
UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance
Stars: ✭ 1,792 (+1959.77%)
Mutual labels:  flutter-plugin
flutter nfc kit
Flutter plugin to provide NFC functionality on Android and iOS, including reading metadata, read & write NDEF records, and transceive layer 3 & 4 data with NFC tags / cards
Stars: ✭ 119 (+36.78%)
Mutual labels:  flutter-plugin
getx-snippets-intelliJ
An extension to accelerate the process of developing applications with flutter, aimed at everyone using the GetX package.
Stars: ✭ 52 (-40.23%)
Mutual labels:  flutter-plugin
Vertical Card Pager
Use dynamic and beautiful card view pagers to help you create great apps.
Stars: ✭ 84 (-3.45%)
Mutual labels:  flutter-plugin
flutter easyloading
✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Stars: ✭ 1,021 (+1073.56%)
Mutual labels:  flutter-plugin
barcode.flutter
barcode generate library for Flutter
Stars: ✭ 58 (-33.33%)
Mutual labels:  flutter-plugin
expanding bottom bar
BottomNavigationBar for Flutter with expanding titles
Stars: ✭ 39 (-55.17%)
Mutual labels:  flutter-plugin
material-about
An about screen to use in your Mobile apps.
Stars: ✭ 37 (-57.47%)
Mutual labels:  flutter-plugin
seo renderer
A Flutter Web Plugin to display Text Widget as Html for SEO purpose
Stars: ✭ 103 (+18.39%)
Mutual labels:  flutter-plugin
flutter-scankit
Flutter QR code scanning
Stars: ✭ 107 (+22.99%)
Mutual labels:  flutter-plugin
getwidget-docs
Get Widgets UI library docs.
Stars: ✭ 17 (-80.46%)
Mutual labels:  flutter-plugin
Free-RASP-Flutter
Flutter library for improving app security and threat monitoring on Android and iOS mobile devices.
Stars: ✭ 62 (-28.74%)
Mutual labels:  flutter-plugin
umeng analytics plugin
Flutter 版友盟统计插件
Stars: ✭ 20 (-77.01%)
Mutual labels:  flutter-plugin
twilio flutter
A Flutter package for Twilio API.
Stars: ✭ 16 (-81.61%)
Mutual labels:  flutter-plugin

Flutter Community: get_version

Buy Me A Coffee Donate github pages

get_version

alt text

Online Demo: https://fluttercommunity.github.io/get_version/

Description

Get the Version Name, Version Code and App ID on iOS and Android.

Setup

Android

Go to build.gradle and update:

defaultConfig {
  versionCode 1
  versionName "1.0"
  minSdkVersion 16
  testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

iOS

Already good to go.

How to Use

Get OS Version:

String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  platformVersion = await GetVersion.platformVersion;
} on PlatformException {
  platformVersion = 'Failed to get platform version.';
}

Get Version Name:

String projectVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  projectVersion = await GetVersion.projectVersion;
} on PlatformException {
  projectVersion = 'Failed to get project version.';
}

Get Version Code:

String projectCode;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  projectCode = await GetVersion.projectCode;
} on PlatformException {
  projectCode = 'Failed to get build number.';
}

Get App ID:

String projectAppID;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  projectAppID = await GetVersion.appID;
} on PlatformException {
  projectAppID = 'Failed to get app ID.';
}

Get App Name:

String projectName;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  projectName = await GetVersion.appName;
} on PlatformException {
  projectName = 'Failed to get app name.';
}

Example

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_version/get_version.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String _projectVersion = '';
  String _projectCode = '';
  String _projectAppID = '';
  String _projectName = '';

  @override
  initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await GetVersion.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    String projectVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      projectVersion = await GetVersion.projectVersion;
    } on PlatformException {
      projectVersion = 'Failed to get project version.';
    }

    String projectCode;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      projectCode = await GetVersion.projectCode;
    } on PlatformException {
      projectCode = 'Failed to get build number.';
    }

    String projectAppID;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      projectAppID = await GetVersion.appID;
    } on PlatformException {
      projectAppID = 'Failed to get app ID.';
    }
    
    String projectName;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      projectName = await GetVersion.appName;
    } on PlatformException {
      projectName = 'Failed to get app name.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
      _projectVersion = projectVersion;
      _projectCode = projectCode;
      _projectAppID = projectAppID;
      _projectName = projectName;
    });
  }

  

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: new SingleChildScrollView(
          child: new ListBody(
            children: <Widget>[
              new Container(
                height: 10.0,
              ),
              new ListTile(
                leading: new Icon(Icons.info),
                title: const Text('Name'),
                subtitle: new Text(_projectName),
              ),
              new Container(
                height: 10.0,
              ),
              new ListTile(
                leading: new Icon(Icons.info),
                title: const Text('Running on'),
                subtitle: new Text(_platformVersion),
              ),
              new Divider(
                height: 20.0,
              ),
               new ListTile(
                leading: new Icon(Icons.info),
                title: const Text('Version Name'),
                subtitle: new Text(_projectVersion),
              ),
              new Divider(
                height: 20.0,
              ),
              new ListTile(
                leading: new Icon(Icons.info),
                title: const Text('Version Code'),
                subtitle: new Text(_projectCode),
              ),
              new Divider(
                height: 20.0,
              ),
              new ListTile(
                leading: new Icon(Icons.info),
                title: const Text('App ID'),
                subtitle: new Text(_projectAppID),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].