{"id":20609494,"url":"https://github.com/fluttercommunity/get_version","last_synced_at":"2025-07-29T20:34:50.356Z","repository":{"id":47813964,"uuid":"130396200","full_name":"fluttercommunity/get_version","owner":"fluttercommunity","description":"Get Version - Get the Version Name, Version Code, Platform and OS Version, and App ID on iOS and Android. Maintainer: @rodydavis","archived":false,"fork":false,"pushed_at":"2023-10-04T01:15:31.000Z","size":2766,"stargazers_count":95,"open_issues_count":12,"forks_count":61,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T15:09:13.367Z","etag":null,"topics":["android","flutter","flutter-plugin","hacktoberfest","ios"],"latest_commit_sha":null,"homepage":"https://fluttercommunity.github.io/get_version/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercommunity.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-20T17:51:48.000Z","updated_at":"2025-02-05T15:09:57.000Z","dependencies_parsed_at":"2024-06-18T18:16:15.729Z","dependency_job_id":"2c2dcfb8-9379-42ac-b744-a1910241c62c","html_url":"https://github.com/fluttercommunity/get_version","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fget_version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fget_version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fget_version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercommunity%2Fget_version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercommunity","download_url":"https://codeload.github.com/fluttercommunity/get_version/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113038,"owners_count":21049771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","flutter","flutter-plugin","hacktoberfest","ios"],"created_at":"2024-11-16T10:13:42.442Z","updated_at":"2025-04-09T21:23:09.944Z","avatar_url":"https://github.com/fluttercommunity.png","language":"Ruby","funding_links":["https://www.buymeacoffee.com/rodydavis","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=WSH3GVC49GNNJ"],"categories":[],"sub_categories":[],"readme":"[![Flutter Community: get_version](https://fluttercommunity.dev/_github/header/get_version)](https://github.com/fluttercommunity/community)\n\n[![Buy Me A Coffee](https://img.shields.io/badge/Donate-Buy%20Me%20A%20Coffee-yellow.svg)](https://www.buymeacoffee.com/rodydavis)\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=WSH3GVC49GNNJ)\n![github pages](https://github.com/fluttercommunity/get_version/workflows/github%20pages/badge.svg)\n\n# get_version\n![alt text](https://github.com/fluttercommunity/get_version/blob/master/screenshots/IMG_0023.PNG)\n\nOnline Demo: https://fluttercommunity.github.io/get_version/\n\n## Description\nGet the Version Name, Version Code and App ID on iOS and Android.\n\n## Setup\n### Android\n\nGo to build.gradle and update:\n\n```gradle\ndefaultConfig {\n  versionCode 1\n  versionName \"1.0\"\n  minSdkVersion 16\n  testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"\n}\n```\n\n### iOS\n\nAlready good to go.\n\n## How to Use\n\nGet OS Version:\n\n```dart\nString platformVersion;\n// Platform messages may fail, so we use a try/catch PlatformException.\ntry {\n  platformVersion = await GetVersion.platformVersion;\n} on PlatformException {\n  platformVersion = 'Failed to get platform version.';\n}\n```\n\nGet Version Name:\n\n```dart\nString projectVersion;\n// Platform messages may fail, so we use a try/catch PlatformException.\ntry {\n  projectVersion = await GetVersion.projectVersion;\n} on PlatformException {\n  projectVersion = 'Failed to get project version.';\n}\n```\n\nGet Version Code:\n\n```dart\nString projectCode;\n// Platform messages may fail, so we use a try/catch PlatformException.\ntry {\n  projectCode = await GetVersion.projectCode;\n} on PlatformException {\n  projectCode = 'Failed to get build number.';\n}\n```\n\nGet App ID:\n\n```dart\nString projectAppID;\n// Platform messages may fail, so we use a try/catch PlatformException.\ntry {\n  projectAppID = await GetVersion.appID;\n} on PlatformException {\n  projectAppID = 'Failed to get app ID.';\n}\n```\n\nGet App Name:\n\n```dart\nString projectName;\n// Platform messages may fail, so we use a try/catch PlatformException.\ntry {\n  projectName = await GetVersion.appName;\n} on PlatformException {\n  projectName = 'Failed to get app name.';\n}\n```\n    \n## Example\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:get_version/get_version.dart';\n\nvoid main() =\u003e runApp(new MyApp());\n\nclass MyApp extends StatefulWidget {\n  @override\n  _MyAppState createState() =\u003e new _MyAppState();\n}\n\nclass _MyAppState extends State\u003cMyApp\u003e {\n  String _platformVersion = 'Unknown';\n  String _projectVersion = '';\n  String _projectCode = '';\n  String _projectAppID = '';\n  String _projectName = '';\n\n  @override\n  initState() {\n    super.initState();\n    initPlatformState();\n  }\n\n  // Platform messages are asynchronous, so we initialize in an async method.\n  initPlatformState() async {\n    String platformVersion;\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      platformVersion = await GetVersion.platformVersion;\n    } on PlatformException {\n      platformVersion = 'Failed to get platform version.';\n    }\n\n    String projectVersion;\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      projectVersion = await GetVersion.projectVersion;\n    } on PlatformException {\n      projectVersion = 'Failed to get project version.';\n    }\n\n    String projectCode;\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      projectCode = await GetVersion.projectCode;\n    } on PlatformException {\n      projectCode = 'Failed to get build number.';\n    }\n\n    String projectAppID;\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      projectAppID = await GetVersion.appID;\n    } on PlatformException {\n      projectAppID = 'Failed to get app ID.';\n    }\n    \n    String projectName;\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      projectName = await GetVersion.appName;\n    } on PlatformException {\n      projectName = 'Failed to get app name.';\n    }\n\n    // If the widget was removed from the tree while the asynchronous platform\n    // message was in flight, we want to discard the reply rather than calling\n    // setState to update our non-existent appearance.\n    if (!mounted) return;\n\n    setState(() {\n      _platformVersion = platformVersion;\n      _projectVersion = projectVersion;\n      _projectCode = projectCode;\n      _projectAppID = projectAppID;\n      _projectName = projectName;\n    });\n  }\n\n  \n\n  @override\n  Widget build(BuildContext context) {\n    return new MaterialApp(\n      home: new Scaffold(\n        appBar: new AppBar(\n          title: new Text('Plugin example app'),\n        ),\n        body: new SingleChildScrollView(\n          child: new ListBody(\n            children: \u003cWidget\u003e[\n              new Container(\n                height: 10.0,\n              ),\n              new ListTile(\n                leading: new Icon(Icons.info),\n                title: const Text('Name'),\n                subtitle: new Text(_projectName),\n              ),\n              new Container(\n                height: 10.0,\n              ),\n              new ListTile(\n                leading: new Icon(Icons.info),\n                title: const Text('Running on'),\n                subtitle: new Text(_platformVersion),\n              ),\n              new Divider(\n                height: 20.0,\n              ),\n               new ListTile(\n                leading: new Icon(Icons.info),\n                title: const Text('Version Name'),\n                subtitle: new Text(_projectVersion),\n              ),\n              new Divider(\n                height: 20.0,\n              ),\n              new ListTile(\n                leading: new Icon(Icons.info),\n                title: const Text('Version Code'),\n                subtitle: new Text(_projectCode),\n              ),\n              new Divider(\n                height: 20.0,\n              ),\n              new ListTile(\n                leading: new Icon(Icons.info),\n                title: const Text('App ID'),\n                subtitle: new Text(_projectAppID),\n              ),\n            ],\n          ),\n        ),\n      ),\n    );\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fget_version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercommunity%2Fget_version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercommunity%2Fget_version/lists"}