diff --git a/packages/image_picker/analysis_options.yaml b/packages/image_picker/analysis_options.yaml new file mode 100644 index 000000000000..4d3c53a24cab --- /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 a2175c098f17..b728788f5ba7 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 b1a7c8b36c00..19cd0752ced3 100755 --- a/packages/image_picker/lib/image_picker.dart +++ b/packages/image_picker/lib/image_picker.dart @@ -8,7 +8,10 @@ import 'dart:io'; 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 @@ class ImagePicker { /// 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 @@ class LostDataResponse { } /// 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 +}