fromGltfBytes static method
Future<Node>
fromGltfBytes(
- Uint8List gltfJson, {
- required GltfResourceResolver resolveUri,
- GltfWarningCallback? onWarning,
Load a multi-file glTF model from the raw bytes of its .gltf
(JSON) file.
Multi-file glTF keeps its geometry buffer and images in separate
files referenced by relative URI. resolveUri fetches each of
those resources by URI, percent-decoded — for example downloading
them relative to the .gltf's own URL, or reading sibling files
from disk. data: URIs are decoded internally and never reach
resolveUri. A document with more than one buffer is supported;
its buffers are concatenated and rebased before use. onWarning,
when given, receives non-fatal import issues; without it they
print instead.
For single-file .glb models use fromGlbBytes instead.
Example:
final node = await Node.fromGltfBytes(
gltfJsonBytes,
resolveUri: (uri) => fetchBytes('$baseUrl/$uri'),
);
Implementation
static Future<Node> fromGltfBytes(
Uint8List gltfJson, {
required GltfResourceResolver resolveUri,
GltfWarningCallback? onWarning,
}) {
return importGltf(gltfJson, resolveUri: resolveUri, onWarning: onWarning);
}