AssetEntity class

The abstraction of assets (images/videos/audios). It represents a series of fields MediaStore on Android and the PHAsset object on iOS/macOS.

Annotations

Constructors

AssetEntity({required String id, required int typeInt, required int width, required int height, int duration = 0, int orientation = 0, bool isFavorite = false, String? title, int? createDateSecond, int? modifiedDateSecond, String? relativePath, double? latitude, double? longitude, String? mimeType, int subtype = 0})
const

Properties

createDateSecond int?
The create time in unix timestamp of the asset.
final
createDateTime DateTime
The create time of the asset in DateTime.
no setter
duration int
The duration of the asset, but in different units.
final
exists Future<bool>
Check whether the asset has been deleted.
no setter
file Future<File?>
Obtain the compressed file of the asset.
no setter
fileWithSubtype Future<File?>
Obtain the compressed file of the asset with subtype.
no setter
hashCode int
The hash code for this object.
no setteroverride
height int
The height of the asset.
final
id String
The ID of the asset.
final
isFavorite bool
Whether the asset is favorite on the device.
final
isLivePhoto bool
Whether the asset is a live photo. Only valid on iOS/macOS.
no setter
latitude double?
Latitude value of the location when shooting.
no setter
longitude double?
Latitude value of the location when shooting.
no setter
mimeType String?
The mime type of the asset.
final
mimeTypeAsync Future<String?>
Get the mime type async.
no setter
modifiedDateSecond int?
The modified time in unix timestamp of the asset.
final
modifiedDateTime DateTime
The modified time of the asset in DateTime.
no setter
orientatedHeight int
The orientated height according to the orientation.
no setter
orientatedSize Size
The orientated size according to the orientation.
no setter
orientatedWidth int
The orientated width according to the orientation.
no setter
orientation int
The orientation of the asset.
final
originBytes Future<Uint8List?>
Obtain the raw data of the asset.
no setter
originFile Future<File?>
Obtain the original file that contain all EXIF information.
no setter
originFileWithSubtype Future<File?>
Obtain the origin file with subtype.
no setter
relativePath String?
The relative path abstraction of the asset.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Size
The Size for the asset.
no setter
subtype int
The subtype of the asset.
final
thumbnailData Future<Uint8List?>
Obtain the thumbnail data with PMConstants.vDefaultThumbnailSize size of the asset, typically use it for preview displays.
no setter
title String?
The title field of the asset.
final
titleAsync Future<String>
  • Android: MediaStore.MediaColumns.DISPLAY_NAME.
  • iOS/macOS: PHAssetResource.originalFilename.
  • no setter
    titleAsyncWithSubtype Future<String>
  • Android: MediaStore.MediaColumns.DISPLAY_NAME.
  • iOS/macOS: PHAssetResource.originalFilename.
  • no setter
    type AssetType
    The type of the asset.
    no setter
    typeInt int
    The type value of the type.
    final
    videoDuration Duration
    The video duration in seconds.
    no setter
    width int
    The width of the asset.
    final

    Methods

    copyWith({String? id, int? typeInt, int? width, int? height, int? duration, int? orientation, bool? isFavorite, String? title, int? createDateSecond, int? modifiedDateSecond, String? relativePath, double? latitude, double? longitude, String? mimeType, int? subtype}) AssetEntity
    getMediaUrl({PMProgressHandler? progressHandler}) Future<String?>
    Provide regular URL for players.
    isLocallyAvailable({bool isOrigin = false, bool withSubtype = false, PMDarwinAVFileType? darwinFileType}) Future<bool>
    Whether this asset is locally available.
    latlngAsync() Future<LatLng>
    Obtain latitude and longitude.
    loadFile({bool isOrigin = true, bool withSubtype = false, PMProgressHandler? progressHandler, PMDarwinAVFileType? darwinFileType}) Future<File?>
    Obtain file of the asset with a PMProgressHandler.
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    obtainForNewProperties() Future<AssetEntity?>
    Refresh properties for the current asset and return a new object.
    thumbnailDataWithOption(ThumbnailOption option, {PMProgressHandler? progressHandler}) Future<Uint8List?>
    Obtain the thumbnail data with the given customized ThumbnailOption.
    thumbnailDataWithSize(ThumbnailSize size, {ThumbnailFormat format = ThumbnailFormat.jpeg, int quality = 100, PMProgressHandler? progressHandler, int frame = 0}) Future<Uint8List?>
    Obtain the thumbnail data with the given width and height of the asset.
    toString() String
    A string representation of this object.
    override

    Operators

    operator ==(Object other) bool
    The equality operator.
    override

    Static Methods

    fromId(String id) Future<AssetEntity?>
    Obtain an entity from ID.