title: Flutter project failing to build on Mac M1
body: <p>I have recently bought a new Mac book with the <a href="https://en.wikipedia.org/wiki/Apple_M1" rel="nofollow noreferrer">M1</a> chip and faced huge issues between Flutter and Firebase in building. I will list both the Flutter error log and Xcode error log.</p>
  <p>Note: I'm building on Flutter channel <em>Master</em></p>
  <p>Flutter Error Log:</p>
  <pre class="lang-none prettyprint-override"><code>    Launching lib/main.dart on iPod touch (7th generation) in debug mode...
      Xcode build done.                                           69.1s
      Failed to build iOS app
  </code></pre>
  <p>Error output from Xcode build:</p>
  <pre class="lang-none prettyprint-override"><code>objc[30795]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1fe91f8f0) and ?? (0x1189402b8). One of the two will be used. Which one is undefined.
  objc[30795]: Class AMSupportURLSession is implemented in both ?? (0x1fe91f940) and ?? (0x118940308). One of the two will be used. Which one is undefined.
  ** BUILD FAILED **
  </code></pre>
  <p>Xcode's output:</p>
  <pre class="lang-none prettyprint-override"><code>/Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPlugin.m:141:20: warning: 'UIAlertView' is deprecated: first deprecated in iOS 9.0 - UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerStyleAlert instead [-Wdeprecated-declarations]
      [[[UIAlertView alloc] initWithTitle:@&quot;Error&quot;
                     ^
  In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
  /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:27:12: note: 'UIAlertView' has been explicitly marked deprecated here
  @interface UIAlertView : UIView
             ^
  1 warning generated.
  /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:17:44: warning: 'UIImagePickerControllerReferenceURL' is deprecated: first deprecated in iOS 11.0 - Will be removed in a future release, use PHPicker. [-Wdeprecated-declarations]
    NSURL *referenceURL = [info objectForKey:UIImagePickerControllerReferenceURL];
                                             ^
  In module 'UIKit' imported from /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/Target Support Files/image_picker/image_picker-prefix.pch:2:
  /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIImagePickerController.h:62:51: note: 'UIImagePickerControllerReferenceURL' has been explicitly marked deprecated here
  UIKIT_EXTERN UIImagePickerControllerInfoKey const UIImagePickerControllerReferenceURL API_DEPRECATED(&quot;Will be removed in a future release, use PHPicker.&quot;, ios(4.1, 11.0)) API_UNAVAILABLE(tvos); // an NSURL that references an asset in the AssetsLibrary framework
                                                    ^
  /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.m:21:47: warning: 'fetchAssetsWithALAssetURLs:options:' is deprecated: first deprecated in iOS 11 - Will be removed in a future release [-Wdeprecated-declarations]
    PHFetchResult&lt;PHAsset *&gt; *result = [PHAsset fetchAssetsWithALAssetURLs:@[ referenceURL ]
                                                ^
  In module 'Photos' imported from /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.7+1/ios/Classes/FLTImagePickerPhotoAssetUtil.h:6:
  /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h:74:1: note: 'fetchAssetsWithALAssetURLs:options:' has been explicitly marked deprecated here
  + (PHFetchResult&lt;PHAsset *&gt; *)fetchAssetsWithALAssetURLs:(NSArray&lt;NSURL *&gt; *)assetURLs options:(nullable PHFetchOptions *)options API_DEPRECATED(&quot;Will be removed in a future release&quot;, ios(8, 11), tvos(8, 11)) API_UNAVAILABLE(macos);
  ^
  2 warnings generated.
  1 warning generated.
  error: the following command failed with exit code 0 but produced no further output
  CompileC /Users/wissamboughannam/Library/Developer/Xcode/DerivedData/Runner-awkucyxpawezvvfjchbivjxuwsah/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/file_picker.build/Objects-normal/x86_64/FilePickerPlugin.o /Users/wissamboughannam/Developer/flutter/.pub-cache/hosted/pub.dartlang.org/file_picker-1.4.2/ios/Classes/FilePickerPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
  /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:58:28: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
  void FIRLoggerInitializeASL() {
                             ^
  /Volumes/Sub/Flutter-Projects/test-project/test_project_app_v2/test_app_2/ios/Pods/FirebaseCore/FirebaseCore/Sources/FIRLogger.m:101:20: warning: this old-style function definition is not preceded by a prototype [-Wstrict-prototypes]
  void FIRResetLogger() {
                     ^
  2 warnings generated.
  
  /Users/wissamboughannam/Developer/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' ('/Users/wissamboughannam/Developer/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&lt;T&gt;
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  /Users/wissamboughannam/Developer/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' ('/Users/wissamboughannam/Developer/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: Analyzing workspace
  note: Constructing build description
  note: Build preparation complete
  note: Removed stale file
  </code></pre>
  <p>As for the Error log from Xcode:</p>
  <pre class="lang-none prettyprint-override"><code>/Users/wissamboughannam/Developer/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' ('/Users/wissamboughannam/Developer/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&lt;T&gt;
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  /Users/wissamboughannam/Developer/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' ('/Users/wissamboughannam/Developer/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
  </code></pre>
  <p>This is the main error, there were many warning, but I'm not sure if they're causing the build failure.</p>
  <p>Running <code>flutter doctor</code> result:</p>
  <pre class="lang-none prettyprint-override"><code>Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel master, 2.1.0-11.0.pre.227, on macOS 11.1 20C69 darwin-arm, locale en-SA)
  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
  [✓] Xcode - develop for iOS and macOS
  [✓] Chrome - develop for the web
  [✓] Android Studio (version 4.1)
  [✓] VS Code (version 1.54.1)
  [✓] Connected device (2 available)
  
  • No issues found!
  </code></pre>