Skip to content

Commit 96075c8

Browse files
Michael Klimushynmormih
authored andcommitted
[image_picker] Lint for public DartDocs (flutter#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.
1 parent 4a24957 commit 96075c8

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This exists to add a lint for missing API docs just on this specific package,
2+
# since not all packages have coverage for all their public members yet and
3+
# adding it in would be non-trivial. `public_member_api_docs` should be applied
4+
# to new packages going forward, and ideally the main `analysis_options.yaml`
5+
# file as soon as possible.
6+
7+
include: ../../analysis_options.yaml
8+
9+
linter:
10+
rules:
11+
- public_member_api_docs

packages/image_picker/example/lib/main.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// ignore_for_file: public_member_api_docs
6+
57
import 'dart:async';
68
import 'dart:io';
79

packages/image_picker/lib/image_picker.dart

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import 'dart:io';
88
import 'package:flutter/foundation.dart';
99
import 'package:flutter/services.dart';
1010

11+
/// Denotes that an image is being picked.
1112
const String kTypeImage = 'image';
13+
14+
/// Denotes that a video is being picked.
1215
const String kTypeVideo = 'video';
1316

1417
/// Specifies the source where the picked image should come from.
@@ -143,14 +146,17 @@ class ImagePicker {
143146
/// See also:
144147
/// * [ImagePicker.retrieveLostData] for more details on retrieving lost data.
145148
class LostDataResponse {
149+
/// Creates an instance with the given [file], [exception], and [type]. Any of
150+
/// the params may be null, but this is never considered to be empty.
146151
LostDataResponse({this.file, this.exception, this.type});
147152

153+
/// Initializes an instance with all member params set to null and considered
154+
/// to be empty.
148155
LostDataResponse.empty()
149156
: file = null,
150157
exception = null,
151-
type = null {
152-
_empty = true;
153-
}
158+
type = null,
159+
_empty = true;
154160

155161
/// Whether it is an empty response.
156162
///
@@ -178,4 +184,10 @@ class LostDataResponse {
178184
}
179185

180186
/// The type of the retrieved data in a [LostDataResponse].
181-
enum RetrieveType { image, video }
187+
enum RetrieveType {
188+
/// A static picture. See [ImagePicker.pickImage].
189+
image,
190+
191+
/// A video. See [ImagePicker.pickVideo].
192+
video
193+
}

0 commit comments

Comments
 (0)