2

I'm trying to implement google's model_viewer into my app. Following the Demo Project, i'm not able to get it to work:

doing: flutter run: gives following error:

/Users/felixjungo/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.24/ios/Classes/FlutterWebView.m:367:23: warning: 'mediaPlaybackRequiresUserAction' is deprecated: first deprecated in iOS 9.0 [-Wdeprecated-declarations] configuration.mediaPlaybackRequiresUserAction = true; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mediaTypesRequiringUserActionForPlayback In module 'WebKit' imported from /Users/felixjungo/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.24/ios/Classes/FlutterWebView.h:6: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfigura tion.h:211:28: note: 'mediaPlaybackRequiresUserAction' has been explicitly marked deprecated here @property (nonatomic) BOOL mediaPlaybackRequiresUserAction API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(8.0, 9.0)); ^ /Users/felixjungo/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.24/ios/Classes/FlutterWebView.m:374:23: warning: 'mediaPlaybackRequiresUserAction' is deprecated: first deprecated in iOS 9.0 [-Wdeprecated-declarations] configuration.mediaPlaybackRequiresUserAction = false; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mediaTypesRequiringUserActionForPlayback In module 'WebKit' imported from /Users/felixjungo/development/flutter/.pub-cache/hosted/pub.dartlang.org/webview_flutter-0.3.24/ios/Classes/FlutterWebView.h:6: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/WebKit.framework/Headers/WKWebViewConfigura tion.h:211:28: note: 'mediaPlaybackRequiresUserAction' has been explicitly marked deprecated here @property (nonatomic) BOOL mediaPlaybackRequiresUserAction API_DEPRECATED_WITH_REPLACEMENT("mediaTypesRequiringUserActionForPlayback", ios(8.0, 9.0)); ^

model_viewer is depending on webview_flutter ^0.3.22 so i'm using

flutter run --no-sound-null-safety

to run it because of the old version of the webview widget. I get following error:

Xcode's output: lib/main.dart:105:11: Error: No named parameter with the name 'src'. src: 'https://modelviewer.dev/shared-assets/models/Astronaut.glb',

lib/main.dart:86:7: Context: The class 'ModelViewer' has a constructor that takes no arguments. class ModelViewer extends StatelessWidget {

Command PhaseScriptExecution failed with a nonzero exit code note: Using new build system note: Building targets in parallel note: Planning build note: Analyzing workspace note: Constructing build description note: Build preparation complete .../ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')

pubspec.yalm:

environment: sdk: '>=2.12.0 <3.0.0'

dependencies: flutter: sdk: flutter model_viewer: ^0.8.1


main.dart:

import 'package:model_viewer/model_viewer.dart';


Can i force model_viewer to use a new version of webview? Does somebody have a clue what could be the problem? I do not get any errors if i delete the ModelViewer Widget from my code, but leave the importer there.

model_viewer is legacy

  • 1
    Upvoted. I'm also looking for this one – Huy Le Jul 25 '21 at 08:00
  • if you fork the model_viewer widget you can upgrade the dependencies in the pup.yalm file and it will run in the "no sound null savety" mode! But i guess it is almost easier to create a webview widget and load googles model_viewer over a URL to your webserver, where you host your models. What i don't get: wich one is better: flutter webview, in app webview or the webview plugin? My main Problem is performace and startup time. – user16479873 Jul 26 '21 at 20:17
  • 1
    + i can get the model_viewer to work but it is not showing the AR Butoon on my iPhone. What is the "Browser" if you surf the web with the webview widget? – user16479873 Jul 26 '21 at 20:20

0 Answers0