AttachmentBuilder class Null safety
Helper for sending attachment in messages. Allows to create attachment from path, File or bytes.
Constructors
-
AttachmentBuilder.bytes(List<
int> bytes, String name, {bool? spoiler}) -
Creates attachment from provided bytes
factory
- AttachmentBuilder.file(File file, {String? name, bool? spoiler})
-
Create attachment from specified file instance. Name will be automatically extracted from path if no name provided.
factory
- AttachmentBuilder.path(String path, {String? name, bool? spoiler})
-
Open file at
path
then read it's contents and prepare to send. Name will be automatically extracted from path if no name provided.factory
Properties
Methods
-
getBase64(
{String defaultFormat = 'png'}) → String - Returns attachment encoded in Data URI scheme format See: https://discord.com/developers/docs/reference#image-data
-
getMultipartFile(
[int? index]) → MultipartFile - creates instance of MultipartFile from attachment
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited