如何在 M1 Mac 中运行 flutter 项目

时间:2021-03-23 08:57:54

标签: ios xcode flutter dart apple-m1

在 android studio 终端中运行命令 flutter run 时,抛出以下错误。 该设备使用 Rossetta 层在 Apple 的 M1 处理器 (MacBook Air) 上运行。

    flutter run      
   Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
   Running Xcode build...                                                  
   Xcode build done.                                           10.7s
   Failed to build iOS app
   Error output from Xcode build:
   ↳
       objc[7304]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x200f40188) and ?? (0x1185702b8). One of the two will be used. Which one is undefined.
       objc[7304]: Class AMSupportURLSession is implemented in both ?? (0x200f401d8) and ?? (0x118570308). One of the two will be used. Which one is undefined.
       ** BUILD FAILED **
   
   
   Xcode's output:
   ↳
       /Applications/Development/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
           return super.inheritFromElement(ancestor, aspect: aspect);
                        ^^^^^^^^^^^^^^^^^^
       /Applications/Development/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class
       'BuildContext'.
        - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Applications/Development/flutter/packages/flutter/lib/src/widgets/framework.dart').
       Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
               ? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T>
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       /Applications/Development/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined
       for the class 'BuildContext'.
        - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/Applications/Development/flutter/packages/flutter/lib/src/widgets/framework.dart').
       Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
               : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   
       Command PhaseScriptExecution failed with a nonzero exit code
       note: Using new build system
       note: Building targets in parallel
       note: Planning build
       note: Constructing build description
       warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor.
       (in target 'Runner' from project 'Runner')
   
   Could not build the application for the simulator.
   Error launching application on iPhone 12 Pro Max.

0 个答案:

没有答案