Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/image_picker/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions packages/image_picker/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
20 changes: 16 additions & 4 deletions packages/image_picker/lib/image_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment on lines +11 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Didn't read the code carefully but I think these can be private. I am not sure if we should hide it at this point as technically it would be a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just leave it public for now, there's not really a reason to risk hiding it after all this time.

const String kTypeVideo = 'video';

/// Specifies the source where the picked image should come from.
Expand Down Expand Up @@ -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.
///
Expand Down Expand Up @@ -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
}