AssetPack class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
Static Properties
devDir
↔ String ?
Unpacked originals read in debug builds (desktop only). Null to disable.
getter/setter pair
ready
→ bool
True once init() has run.
no setter
Static Methods
contains (String path )
→ bool
True if path is in an open pack.
init ({required List <int > key , List <String > packs = const ['assets/packs/game.owp'] , String ? devDir = 'protected' })
→ Future <void >
Opens the packs. Call once at start-up, before any packed asset is
loaded. packs are Flutter asset paths listed in the game's pubspec.
installTextureHandler (LoadingManager manager )
→ void
Makes every texture requested through manager (e.g. by an MTL file)
come from the packs when it is packed. Safe to call more than once.
keyFromParts (List <List <int > > parts )
→ List <int >
Rebuilds the key from parts that XOR together. Keeping the key as
several scattered parts (and building with --obfuscate) means it never
appears as one block in the executable. pack_assets --gen-key prints
the parts for you.
loadBytes (String path )
→ Future <Uint8List >
Loads any asset: devDir (debug), then the packs, then the bundle.
loadGLTF (String path )
→ Future <GLTFData? >
Replaces THREE.GLTFLoader().fromAsset(path). Packed models must be
self-contained .glb files (textures embedded).
loadOBJ (String objPath , {String ? mtlPath , LoadingManager? manager })
→ Future <Group? >
Loads an OBJ with its optional MTL. Textures named in the MTL are taken
from the packs when they are packed, otherwise from the bundle.
loadString (String path )
→ Future <String >
loadTexture (String path , {bool flipY = false })
→ Future <Texture? >
Replaces THREE.TextureLoader().fromAsset(path).
packedBytes (String path )
→ Future <Uint8List ? >
Bytes from devDir (debug) or a pack; null if path is neither, meaning
it should be loaded from the Flutter bundle as normal.