AssetEntity class Null safety

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.
read-only
duration int
The duration of the asset, but in different units.
final
exists Future<bool>
Check whether the asset has been deleted.
read-only
file Future<File?>
Obtain the compressed file of the asset.
read-only
fileWithSubtype Future<File?>
Obtain the compressed file of the asset with subtype.
read-only
hashCode int
The hash code for this object.
read-only, override
height int
The height of the asset.
final
id String
The ID of the asset.
final
isFavorite bool
Whether the asset is favorited on the device.
final
isLivePhoto bool
Whether the asset is a live photo. Only valid on iOS/macOS.
read-only
latitude double?
Latitude value of the location when shooting.
read-only
longitude double?
Latitude value of the location when shooting.
read-only
mimeType String?
The mime type of the asset.
final
mimeTypeAsync Future<String?>
Get the mime type async.
read-only
modifiedDateSecond int?
The modified time in unix timestamp of the asset.
final
modifiedDateTime DateTime
The modified time of the asset in DateTime.
read-only
orientatedHeight int
read-only
orientatedSize Size
read-only
orientatedWidth int
read-only
orientation int
The orientation of the asset.
final
originBytes Future<Uint8List?>
Obtain the raw data of the asset.
read-only
originFile Future<File?>
Obtain the original file that contain all EXIF informations.
read-only
originFileWithSubtype Future<File?>
Obtain the origin file with subtype.
read-only
relativePath String?
The relative path abstraction of the asset.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
size Size
The Size for the asset.
read-only
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.
read-only
title String?
The title field of the asset.
final
titleAsync Future<String>
  • Android: MediaStore.MediaColumns.DISPLAY_NAME.
  • iOS/macOS: PHAssetResource.originalFilename.
  • read-only
    titleAsyncWithSubtype Future<String>
  • Android: MediaStore.MediaColumns.DISPLAY_NAME.
  • iOS/macOS: PHAssetResource.originalFilename.
  • read-only
    type AssetType
    The type of the asset.
    read-only
    typeInt int
    The type value of the type.
    final
    videoDuration Duration
    The video duration in seconds.
    read-only
    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() Future<String?>
    Provide regular URL for players. Only available for audios and videos.
    isLocallyAvailable({bool isOrigin = false}) Future<bool>
    Whether this asset is locally available.
    latlngAsync() Future<LatLng>
    Obtain latitude and longitude.
    loadFile({bool isOrigin = true, bool withSubtype = false, PMProgressHandler? progressHandler}) Future<File?>
    Obtain file of the asset with a PMProgressHandler.
    noSuchMethod(Invocation invocation) → dynamic
    Invoked when a non-existent 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}) 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.