File class abstract
This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/BOT_TOKEN/FILE_PATH. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
- Annotations
-
- @freezed
Constructors
- File.new({@JsonKey(name: 'file_id') required String fileId, @JsonKey(name: 'file_unique_id') required String fileUniqueId, @JsonKey(name: 'file_size') int? fileSize, @JsonKey(name: 'file_path') String? filePath})
-
Constructs the File object.
constfactory
-
File.fromJson(Map<
String, dynamic> json) -
Creates the File object from the given JSON model.
factory
Properties
-
copyWith
→ $FileCopyWith<
File> -
Create a copy of File
with the given fields replaced by the non-null parameter values.
no setterinherited
- fileId → String
-
Unique identifier for this file
no setterinherited
- fileName → String?
-
Returns the file name of the file.
no setter
- filePath → String?
-
File path. Use https://api.telegram.org/file/bottoken/file_path to
get the file.
no setterinherited
- fileSize → int?
-
File size, if known
no setterinherited
- fileUniqueId → String
-
Unique identifier for this file, which is supposed to be the same over
time and for different bots. Can't be used to download or reuse the
file.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
download(
{String? path, String? token}) → Future< File?> -
This is an advanced method of Televerse. This method downloads the
particular file and saves it to the specified
path
. -
getBytes(
[String? token]) → Future< Uint8List?> -
This is an advanced method in Televerse. This returns
Uint8List?
representing the byte data of the file. -
getDownloadURI(
[String? token]) → Uri - Returns the Uri object of the download URL. This is an shorthand method for:
-
getDownloadUrl(
[String? token]) → String - Returns the download URL for the particular file as String
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
Serializes this File to a JSON map.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited