{"id":13685935,"url":"https://github.com/hui-z/flutter_install_plugin","last_synced_at":"2025-04-06T14:12:24.121Z","repository":{"id":48962081,"uuid":"152603117","full_name":"hui-z/flutter_install_plugin","owner":"hui-z","description":"A flutter plugin for install apk for android; and using url to go to app store for iOS.","archived":false,"fork":false,"pushed_at":"2023-10-17T23:11:11.000Z","size":249,"stargazers_count":106,"open_issues_count":12,"forks_count":135,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T12:09:10.937Z","etag":null,"topics":["flutter-plugin"],"latest_commit_sha":null,"homepage":"","language":"Dart","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/hui-z.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-10-11T14:15:13.000Z","updated_at":"2025-02-26T03:15:39.000Z","dependencies_parsed_at":"2024-01-14T18:05:30.039Z","dependency_job_id":null,"html_url":"https://github.com/hui-z/flutter_install_plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hui-z%2Fflutter_install_plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hui-z%2Fflutter_install_plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hui-z%2Fflutter_install_plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hui-z%2Fflutter_install_plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hui-z","download_url":"https://codeload.github.com/hui-z/flutter_install_plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492557,"owners_count":20947545,"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":["flutter-plugin"],"created_at":"2024-08-02T14:00:59.497Z","updated_at":"2025-04-06T14:12:24.102Z","avatar_url":"https://github.com/hui-z.png","language":"Dart","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# install_plugin\n\n[![Build Status](https://travis-ci.org/hui-z/flutter_install_plugin.svg?branch=master)](https://travis-ci.org/hui-z/flutter_install_plugin#)\n[![pub package](https://img.shields.io/pub/v/install_plugin.svg)](https://pub.dartlang.org/packages/install_plugin)\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/hui-z/flutter_install_plugin/blob/master/LICENSE)\n\nWe use the `install_plugin` plugin to install apk for android; and using url to go to app store for iOS.\n\n## Usage\n\nTo use this plugin, add `install_plugin` as a dependency in your pubspec.yaml file. For example:\n```yaml\ndependencies:\n  install_plugin: '^2.1.0'\n```\n\n## iOS\nYour project need create with swift.\n\n##  Android\nYou need to request permission for READ_EXTERNAL_STORAGE to read the apk file. You can handle the storage permission using [flutter_permission_handler](https://github.com/BaseflowIT/flutter-permission-handler).\n```\n \u003c!-- read permissions for external storage --\u003e\n \u003cuses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" /\u003e\n```\nIn Android version \u003e= 8.0 , You need to request permission for REQUEST_INSTALL_PACKAGES to install the apk file\n ```\n \u003c!-- installation package permissions --\u003e\n \u003cuses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\" /\u003e\n ```\nIn Android version \u003c= 6.0 , You need to request permission for WRITE_EXTERNAL_STORAGE to copy the apk from the app private location to the download directory\n ```\n \u003c!-- write permissions for external storage --\u003e\n \u003cuses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /\u003e\n ```\n\n## Example\ninstall apk from the internet \n``` dart\n  _networkInstallApk() async {\n    if (_progressValue != 0 \u0026\u0026 _progressValue \u003c 1) {\n      _showResMsg(\"Wait a moment, downloading\");\n      return;\n    }\n\n    _progressValue = 0.0;\n    var appDocDir = await getTemporaryDirectory();\n    String savePath = appDocDir.path + \"/takeaway_phone_release_1.apk\";\n    String fileUrl =\n        \"https://s3.cn-north-1.amazonaws.com.cn/mtab.kezaihui.com/apk/takeaway_phone_release_1.apk\";\n    await Dio().download(fileUrl, savePath, onReceiveProgress: (count, total) {\n      final value = count / total;\n      if (_progressValue != value) {\n        setState(() {\n          if (_progressValue \u003c 1.0) {\n            _progressValue = count / total;\n          } else {\n            _progressValue = 0.0;\n          }\n        });\n        print((_progressValue * 100).toStringAsFixed(0) + \"%\");\n      }\n    });\n\n    final res = await InstallPlugin.install(savePath);\n    _showResMsg(\n        \"install apk ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}\");\n  }\n```\n\ninstall apk from the local storage\n``` dart\n  _localInstallApk() async {\n    FilePickerResult? result = await FilePicker.platform.pickFiles();\n    if (result != null) {\n      final res = await InstallPlugin.install(result.files.single.path ?? '');\n      _showResMsg(\n          \"install apk ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}\");\n    } else {\n      // User canceled the picker\n      _showResMsg(\"User canceled the picker apk\");\n    }\n  }\n```\n\nGo to AppStore , example appStore url : https://itunes.apple.com/cn/app/%E5%86%8D%E6%83%A0%E5%90%88%E4%BC%99%E4%BA%BA/id1375433239?l=zh\u0026ls=1\u0026mt=8\n``` dart\n  _gotoAppStore(String url) async {\n    url = url.isEmpty ? _defaultUrl : url;\n    final res = await InstallPlugin.install(url);\n    _showResMsg(\n        \"go to appstroe ${res['isSuccess'] == true ? 'success' : 'fail:${res['errorMessage'] ?? ''}'}\");\n  }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhui-z%2Fflutter_install_plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhui-z%2Fflutter_install_plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhui-z%2Fflutter_install_plugin/lists"}