[image_picker] Lint for public DartDocs (#2270)
Missing DartDocs were recently added to this plugin. Add a
package-specific analysis options to make sure that they don't regress
going forward.
diff --git a/packages/image_picker/analysis_options.yaml b/packages/image_picker/analysis_options.yaml
new file mode 100644
index 0000000..4d3c53a
--- /dev/null
+++ b/packages/image_picker/analysis_options.yaml
@@ -0,0 +1,11 @@
+# This exists to add a lint for missing API docs just on this specific package,
+# since not all packages have coverage for all their public members yet and
+# adding it in would be non-trivial. `public_member_api_docs` should be applied
+# to new packages going forward, and ideally the main `analysis_options.yaml`
+# file as soon as possible.
+
+include: ../../analysis_options.yaml
+
+linter:
+ rules:
+ - public_member_api_docs
diff --git a/packages/image_picker/example/lib/main.dart b/packages/image_picker/example/lib/main.dart
index a2175c0..b728788 100755
--- a/packages/image_picker/example/lib/main.dart
+++ b/packages/image_picker/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 'dart:io';
diff --git a/packages/image_picker/lib/image_picker.dart b/packages/image_picker/lib/image_picker.dart
index b1a7c8b..19cd075 100755
--- a/packages/image_picker/lib/image_picker.dart
+++ b/packages/image_picker/lib/image_picker.dart
@@ -8,7 +8,10 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
+/// Denotes that an image is being picked.
const String kTypeImage = 'image';
+
+/// Denotes that a video is being picked.
const String kTypeVideo = 'video';
/// Specifies the source where the picked image should come from.
@@ -143,14 +146,17 @@
/// See also:
/// * [ImagePicker.retrieveLostData] for more details on retrieving lost data.
class LostDataResponse {
+ /// Creates an instance with the given [file], [exception], and [type]. Any of
+ /// the params may be null, but this is never considered to be empty.
LostDataResponse({this.file, this.exception, this.type});
+ /// Initializes an instance with all member params set to null and considered
+ /// to be empty.
LostDataResponse.empty()
: file = null,
exception = null,
- type = null {
- _empty = true;
- }
+ type = null,
+ _empty = true;
/// Whether it is an empty response.
///
@@ -178,4 +184,10 @@
}
/// The type of the retrieved data in a [LostDataResponse].
-enum RetrieveType { image, video }
+enum RetrieveType {
+ /// A static picture. See [ImagePicker.pickImage].
+ image,
+
+ /// A video. See [ImagePicker.pickVideo].
+ video
+}