PhotoManager class

The core manager of this package, providing methods for accessing and managing assets.

Constructors

PhotoManager.withPlugin([PhotoManagerPlugin? photoManagerPlugin])
Creates a new instance of the PhotoManagerPlugin class with an optional plugin instance to use instead of the global singleton.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

editor → Editor
An editor instance for performing edits on assets.
final
notifyingOfChange → bool
Whether assets change event should be notified.
no setter
notifyStream → Stream<bool>
The notify enable flag in stream.
no setter
plugin → PhotoManagerPlugin
The global singleton of the PhotoManagerPlugin class that handles all method channels.
no setter

Static Methods

addChangeCallback(ValueChanged<MethodCall> callback) → void
Adds a callback function to be executed upon asset changes.
cancelAllRequest() → Future<void>
Cancel all loading.
cancelRequest(PMCancelToken cancelToken) → Future<void>
Cancel the request with the given cancelToken.
canManageMedia() → Future<bool>
Whether the app currently holds the Android MANAGE_MEDIA special permission (Android 12+ / API 31+).
clearFileCache() → Future<void>
Clear all file caches. The method does not supported on OpenHarmony.
forceOldApi() → Future<void>
Forces the plugin to use the old API for accessing the device's media library on Android 10 and above.
getAssetCount({PMFilter? filterOption, RequestType type = RequestType.common}) → Future<int>
Returns the count of assets.
getAssetListPaged({required int page, required int pageCount, PMFilter? filterOption, RequestType type = RequestType.common}) → Future<List<AssetEntity>>
Get the asset list with page.
getAssetListRange({required int start, required int end, PMFilter? filterOption, RequestType type = RequestType.common}) → Future<List<AssetEntity>>
Get the asset list with range.
getAssetPathList({bool hasAll = true, bool onlyAll = false, RequestType type = RequestType.common, PMFilter? filterOption, PMPathFilter pathFilterOption = const PMPathFilter()}) → Future<List<AssetPathEntity>>
Obtain albums/folders list with couple filter options.
getPermissionState({required PermissionRequestOption requestOption}) → Future<PermissionState>
Get the current PermissionState of the photo library with the given requestOption.
getVerboseFilePath() → String?
Get the verbose file path
openSetting() → Future<void>
Open the system settings page of the current app.
presentLimited({RequestType type = RequestType.all}) → Future<void>
Prompts the limited assets selection modal on iOS, or the system photo picker on Android 14+ (API 34+).
releaseCache() → Future<void>
Release native caches, there are no common use case for this method, so this method is not recommended.
removeChangeCallback(ValueChanged<MethodCall> callback) → void
Removes a callback function from the list to be executed upon asset changes.
requestManageMedia() → Future<bool>
Opens the system Settings page where the user can grant the Android MANAGE_MEDIA permission to this app. Returns true if the Settings intent was launched.
requestPermissionExtend({PermissionRequestOption requestOption = const PermissionRequestOption()}) → Future<PermissionState>
Android (AndroidManifest.xml)
setIgnorePermissionCheck(bool ignore) → Future<void>
Whether to ignore all runtime permissions check.
setLog(bool isLog, {String? verboseFilePath}) → Future<void>
Controls whether the plugin should log messages to the console during operation.
startChangeNotify() → Future<void>
Enables asset change notifications.
stopChangeNotify() → Future<void>
Disables asset change notifications.
systemVersion() → Future<String>
Get the system version.