{"id":26555527,"url":"https://github.com/cybex-dev/volume_watcher_plus","last_synced_at":"2026-05-08T08:03:37.379Z","repository":{"id":283712593,"uuid":"952677977","full_name":"cybex-dev/volume_watcher_plus","owner":"cybex-dev","description":"watcher the volume change on android and ios platform","archived":false,"fork":false,"pushed_at":"2025-03-31T18:53:50.000Z","size":175,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-31T19:38:15.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cybex-dev.png","metadata":{"files":{"readme":"README-ZH.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":"2025-03-21T17:27:02.000Z","updated_at":"2025-03-31T18:53:41.000Z","dependencies_parsed_at":"2025-03-21T18:46:01.009Z","dependency_job_id":null,"html_url":"https://github.com/cybex-dev/volume_watcher_plus","commit_stats":null,"previous_names":["cybex-dev/volume_watcher_plus"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cybex-dev/volume_watcher_plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybex-dev%2Fvolume_watcher_plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybex-dev%2Fvolume_watcher_plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybex-dev%2Fvolume_watcher_plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybex-dev%2Fvolume_watcher_plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cybex-dev","download_url":"https://codeload.github.com/cybex-dev/volume_watcher_plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cybex-dev%2Fvolume_watcher_plus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32772048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2025-03-22T10:53:28.240Z","updated_at":"2026-05-08T08:03:37.363Z","avatar_url":"https://github.com/cybex-dev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Language: [English](README.md) | [中文简体](README-ZH.md)\n\n# volume_watcher_plus\n* 支持iOS和Android实时返回系统音量值，最大音量，初始音量，支持集卷。\n\n## 入门\n```\ndependencies:\n  volume_watcher_plus: ^2.1.3\n```\n\n## 对外提供如下方法：\n```\nVolumeWatcher.platformVersion\nVolumeWatcher.getMaxVolume\nVolumeWatcher.getCurrentVolume\nVolumeWatcher.setVolume(0.0)\nVolumeWatcher.addListener((double volume) {});\nVolumeWatcher.removeListener(listenerId);\n//仅对IOS生效\nVolumeWatcher.hideVolumeView = true;\n```\n\n## 对外提供监听：\n```\nVolumeWatcher(\n  onVolumeChangeListener: (double volume) {\n    ///do sth.\n  },\n)\n```\n\n或者\n\n```\nfinal listenerId = VolumeWatcher.addListener((double volume) {});\n\n// You can also cancel the listener with\nVolumeWatcher.removeListener(listenerId);\n```\n\n## 使用示例：\n```\nimport 'package:flutter/material.dart';\nimport 'dart:async';\n\nimport 'package:flutter/services.dart';\nimport 'package:volume_watcher_plus/volume_watcher_plus.dart';\n\nvoid main() {\n  runApp(MyApp());\n}\n\nclass MyApp extends StatefulWidget {\n  @override\n  _MyAppState createState() =\u003e _MyAppState();\n}\n\nclass _MyAppState extends State\u003cMyApp\u003e {\n  String _platformVersion = 'Unknown';\n  double currentVolume = 0;\n  double initVolume = 0;\n  double maxVolume = 0;\n\n  @override\n  void initState() {\n    super.initState();\n    initPlatformState();\n  }\n\n  // Platform messages are asynchronous, so we initialize in an async method.\n  Future\u003cvoid\u003e initPlatformState() async {\n    String platformVersion;\n\n    // Platform messages may fail, so we use a try/catch PlatformException.\n    try {\n      VolumeWatcher.hideVolumeView = true;\n      platformVersion = await VolumeWatcher.platformVersion;\n    } on PlatformException {\n      platformVersion = 'Failed to get platform version.';\n    }\n\n    double initVolume = 0;\n    double maxVolume = 0;\n    try {\n      initVolume = await VolumeWatcher.getCurrentVolume;\n      maxVolume = await VolumeWatcher.getMaxVolume;\n    } on PlatformException {\n      platformVersion = 'Failed to get volume.';\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      this.initVolume = initVolume;\n      this.maxVolume = maxVolume;\n    });\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      home: Scaffold(\n        appBar: AppBar(\n          title: const Text('Plugin Example App'),\n        ),\n        body: Center(\n          child: Column(\n            mainAxisAlignment: MainAxisAlignment.center,\n            children: \u003cWidget\u003e[\n              VolumeWatcher(\n                onVolumeChangeListener: (double volume) {\n                  setState(() {\n                    currentVolume = volume;\n                  });\n                },\n              ),\n              Text(\"System Version=$_platformVersion\"),\n              Text(\"Maximum Volume=$maxVolume\"),\n              Text(\"Initial Volume=$initVolume\"),\n              Text(\"Current Volume=$currentVolume\"),\n              ElevatedButton(\n                onPressed: () {\n                  VolumeWatcher.setVolume(maxVolume * 0.5);\n                },\n                child: Text(\"Set the volume to: ${maxVolume * 0.5}\"),\n              ),\n              ElevatedButton(\n                onPressed: () {\n                  VolumeWatcher.setVolume(maxVolume * 0.0);\n                },\n                child: Text(\"Set the volume to: ${maxVolume * 0.0}\"),\n              )\n            ],\n          ),\n        ),\n      ),\n    );\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybex-dev%2Fvolume_watcher_plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcybex-dev%2Fvolume_watcher_plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcybex-dev%2Fvolume_watcher_plus/lists"}