Skip to main content

AssetBundle

Trait AssetBundle 

Source
pub trait AssetBundle: Debug {
    // Required method
    fn load(
        &self,
        key: &str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>>>>;
}
Expand description

Bytes for a named asset. Flutter AssetBundle.

Answering takes time — a bundle may be reading a file or the network — so it answers with a future, as Dart’s does. Flutter’s also carries string and structured helpers, its own caching and a network fallback; those are deferred.

Required Methods§

Source

fn load( &self, key: &str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, String>>>>

Reads a binary asset. Dart throws when the asset is missing; here that is Err.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§