Skip to main content

NetworkImage

Struct NetworkImage 

Source
pub struct NetworkImage {
    pub url: String,
    pub scale: f64,
    pub headers: Option<HeaderMap>,
}
Expand description

Decodes an image from a URL. Flutter NetworkImage.

The bytes come from the platform’s HTTP client (Platform::http), which is NSURLSession on Apple’s systems and fetch in a browser; an app may give the request headers and a scale. The image is cached by URL, scale and headers, so every widget showing the same picture shares one fetch and one decode.

Fields§

§url: String

The URL to fetch the image from.

§scale: f64

Linear pixels per logical point in the decoded image.

§headers: Option<HeaderMap>

The HTTP headers to send with the request.

Implementations§

Source§

impl NetworkImage

Source

pub fn new(url: impl Into<String>) -> NetworkImage

Creates a provider for the image at url at the natural scale.

Source

pub fn scale(self, scale: f64) -> NetworkImage

Dart NetworkImage(scale:).

Source

pub fn headers(self, headers: HeaderMap) -> NetworkImage

The headers the request carries, as Dart’s headers map.

Trait Implementations§

Source§

impl Clone for NetworkImage

Source§

fn clone(&self) -> NetworkImage

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NetworkImage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl ImageProvider for NetworkImage

Source§

fn key(&self, _configuration: &ImageConfiguration) -> ImageCacheKey

What names this image in the cache. Flutter obtainKey. Read more
Source§

fn load_image( &self, app: &mut App, key: &ImageCacheKey, ) -> Retained<Handle<ImageStreamCompleter>>

Starts decoding, answering with the completer that will carry the frame. Flutter loadImage. Read more
Source§

fn resolve( &self, app: &mut App, configuration: &ImageConfiguration, ) -> Retained<Handle<ImageStream>>

The stream for this image, sharing whatever the cache already has. Flutter resolve.

Auto Trait Implementations§

§

impl Forget for NetworkImage

§

impl Freeze for NetworkImage
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const [Pos] is !null: Freeze, PhantomData<[Pos]>: Freeze, PhantomData<Bucket<HeaderValue>>: Freeze, PhantomData<ExtraValue<HeaderValue>>: Freeze,

§

impl Move for NetworkImage

§

impl RefUnwindSafe for NetworkImage

§

impl Send for NetworkImage
where RawVecInner: Send, BoxRaw<[Pos]>: Send, Bytes: Send,

§

impl Sync for NetworkImage
where RawVecInner: Sync, BoxRaw<[Pos]>: Sync, Bytes: Sync,

§

impl Unpin for NetworkImage
where *const u8 is !null: Unpin, Box<[Pos]>: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin,

§

impl UnsafeUnpin for NetworkImage

§

impl UnwindSafe for NetworkImage
where RawVecInner: UnwindSafe, BoxRaw<[Pos]>: UnwindSafe, *const u8: UnwindSafe, Align8<*mut ()>: UnwindSafe, &'static Vtable: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,