0

I am Created a 3D model and exported the file in the extension .GLB I like to use that file in flutter is there any way to use.

And I have tried with this dependencies model_viewer_plus: ^1.5.0, babylon_dart 1.1.2 and babylonjs_viewer 1.2.1 this and not working.

Vasanthan Raj
  • 126
  • 1
  • 9
  • What does "not working" mean? Do you get errors? Please post a [mcve] and any errors you get. – nvoigt Feb 09 '23 at 06:57
  • For babylonJs_viewer it shows 404 Error and for the model_viewer is not working in the current SDK version. I am using the SDK version as environment: sdk: '>=2.19.0 <3.0.0' – Vasanthan Raj Feb 09 '23 at 11:51

1 Answers1

0

Try to use model_viewer package inorder to display 3D model in your app.

Try my code to give you an idea:

import 'package:flutter/material.dart';
import 'package:model_viewer/model_viewer.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ModelViewer(
          src: 'assets/model.glb',
          alt: 'A 3D model',
          ar: true,
          autoPlay: true,
          preferredDevicePixelRatio: 1.0,
        ),
      ),
    );
  }
}
  • ModelViewer is not working on the current SDK version. I am using the SDK version environment: sdk: '>=2.19.0 <3.0.0' – Vasanthan Raj Feb 09 '23 at 11:49
  • While using the depedency it showing this error Because model_viewer >=0.2.0 depends on webview_flutter ^0.3.22 and babylonjs_viewer 1.2.1 depends on webview_flutter ^2.8.0, model_viewer >=0.2.0 is incompatible with babylonjs_viewer 1.2.1. And because no versions of babylonjs_viewer match >1.2.1 <2.0.0, model_viewer >=0.2.0 is incompatible with babylonjs_viewer ^1.2.1. So, because test_3d_model depends on both babylonjs_viewer ^1.2.1 and model_viewer ^0.8.1, version solving failed. – Vasanthan Raj Feb 09 '23 at 12:09
  • You can either upgrade or downgrade the versions of either model_viewer or babylonjs_viewer so that they both depend on the same version of webview_flutter.. Try also diff. package that provide 3D Model capabilities. – Unknown Developer Feb 10 '23 at 02:36
  • If I do that My Application throwing the error like SDK version is Lower or Higher – Vasanthan Raj Feb 10 '23 at 06:07