Skip to content

Commit cf534ee

Browse files
chore(deps): bump web from 0.5.1 to 1.0.0 in /packages/battery_plus/battery_plus (#3103)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Miguel Beltran <[email protected]>
1 parent 1f23910 commit cf534ee

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

packages/battery_plus/battery_plus/lib/src/battery_plus_web.dart

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'dart:js_interop';
33

44
import 'package:battery_plus_platform_interface/battery_plus_platform_interface.dart';
55
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
6-
import 'package:web/web.dart' as web;
6+
import 'package:web/web.dart';
77

88
/// The web implementation of the BatteryPlatform of the Battery plugin.
99
///
@@ -18,7 +18,7 @@ class BatteryPlusWebPlugin extends BatteryPlatform {
1818
/// Return [BatteryManager] if the BatteryManager API is supported by the User Agent.
1919
Future<BatteryManager?> _getBatteryManager() async {
2020
try {
21-
return await web.window.navigator.getBattery()?.toDart;
21+
return await window.navigator.getBattery().toDart;
2222
} on NoSuchMethodError catch (_) {
2323
// BatteryManager API is not supported this User Agent.
2424
return null;
@@ -80,7 +80,7 @@ class BatteryPlusWebPlugin extends BatteryPlatform {
8080
_checkBatteryChargingState(batteryManager.charging),
8181
);
8282

83-
batteryManager.onchargingchange = (web.Event _) {
83+
batteryManager.onchargingchange = (Event _) {
8484
_batteryChangeStreamController?.add(
8585
_checkBatteryChargingState(batteryManager.charging),
8686
);
@@ -105,21 +105,3 @@ class BatteryPlusWebPlugin extends BatteryPlatform {
105105
}
106106
}
107107
}
108-
109-
extension on web.Navigator {
110-
/// https://developer.mozilla.org/en-US/docs/Web/API/Navigator/getBattery
111-
external JSPromise<BatteryManager>? getBattery();
112-
}
113-
114-
/// BatteryManager API
115-
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager
116-
extension type BatteryManager(JSObject _) implements JSObject {
117-
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager/level
118-
external double get level;
119-
120-
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager/charging
121-
external bool get charging;
122-
123-
/// https://developer.mozilla.org/en-US/docs/Web/API/BatteryManager/chargingchange_event
124-
external set onchargingchange(JSFunction fn);
125-
}

packages/battery_plus/battery_plus/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ dependencies:
3434
battery_plus_platform_interface: ^2.0.1
3535
meta: ^1.8.0
3636
upower: ^0.7.0
37-
web: ^0.5.0
37+
web: ^1.0.0
3838

3939
dev_dependencies:
4040
flutter_test:

0 commit comments

Comments
 (0)