Closed sangjin-hash closed 6 months ago
If you store 3d models in file system, use getApplicationDocumentsDirectory()
this method.
I tried to use getApplicationSupportDirectory()
, but it doesn't work on iOS(In Android, it works). I think the viewer cannot find the file in iOS. If you use getApplicationDocumentsDirectory()
, the viewer can access the file!
And the viewer's src must be configured as follows.
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Flutter3DViewer(
progressBarColor: Palette.valueSky,
controller: controller,
src: file://$filePath,
)
)
I confirmed that it works well on Android and iOS.
In my app, glb files are downloaded from the server and saved in internal storage. I used
getApplicationSupportDirectory()
of thepath_provider
library to save the glb file. I confirmed that it was downloaded from the server and saved in that path(/data/user/0/[package name]/files/Model_1.glb
).The body of the scaffold is as follows
The
filePath
means the path where the glb file is saved. Although the file works well and exists in the path, the following error occurs when loading it into the 3D viewer.Is it working by loading from internal storage in device of Android and iOS?