diff --git a/packages/battery/CHANGELOG.md b/packages/battery/CHANGELOG.md index 12a830069fcb..5bd557a7b53d 100644 --- a/packages/battery/CHANGELOG.md +++ b/packages/battery/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.1+5 + +* Fix pedantic linter errors. + ## 0.3.1+4 * Update and migrate iOS example project. diff --git a/packages/battery/analysis_options.yaml b/packages/battery/analysis_options.yaml deleted file mode 100644 index d4ccef63f1d1..000000000000 --- a/packages/battery/analysis_options.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# This is a temporary file to allow us to land a new set of linter rules in a -# series of manageable patches instead of one gigantic PR. It disables some of -# the new lints that are already failing on this plugin, for this plugin. It -# should be deleted and the failing lints addressed as soon as possible. - -include: ../../analysis_options.yaml - -analyzer: - errors: - public_member_api_docs: ignore - unawaited_futures: ignore diff --git a/packages/battery/example/lib/main.dart b/packages/battery/example/lib/main.dart index 0feaa0503e45..1c1dfcf252b6 100644 --- a/packages/battery/example/lib/main.dart +++ b/packages/battery/example/lib/main.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// ignore_for_file: public_member_api_docs + import 'dart:async'; import 'package:flutter/material.dart'; @@ -63,6 +65,7 @@ class _MyHomePageState extends State { child: const Icon(Icons.battery_unknown), onPressed: () async { final int batteryLevel = await _battery.batteryLevel; + // ignore: unawaited_futures showDialog( context: context, builder: (_) => AlertDialog( diff --git a/packages/battery/lib/battery.dart b/packages/battery/lib/battery.dart index 96f470e5bbb5..091b001f749f 100644 --- a/packages/battery/lib/battery.dart +++ b/packages/battery/lib/battery.dart @@ -8,9 +8,21 @@ import 'package:flutter/services.dart'; import 'package:meta/meta.dart' show visibleForTesting; /// Indicates the current battery state. -enum BatteryState { full, charging, discharging } +enum BatteryState { + /// The battery is completely full of energy. + full, + /// The battery is currently storing energy. + charging, + + /// The battery is currently losing energy. + discharging +} + +/// API for accessing information about the battery of the device the Flutter +/// app is currently running on. class Battery { + /// Initializes the plugin and starts listening for potential platform events. factory Battery() { if (_instance == null) { final MethodChannel methodChannel = @@ -22,6 +34,8 @@ class Battery { return _instance; } + /// This constructor is only used for testing and shouldn't be accessed by + /// users of the plugin. It may break or change at any time. @visibleForTesting Battery.private(this._methodChannel, this._eventChannel); diff --git a/packages/battery/pubspec.yaml b/packages/battery/pubspec.yaml index 13f84ba5eaf6..ae611bd2d428 100644 --- a/packages/battery/pubspec.yaml +++ b/packages/battery/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for accessing information about the battery state (full, charging, discharging) on Android and iOS. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/battery -version: 0.3.1+4 +version: 0.3.1+5 flutter: plugin: