Flutter error 'package:flutter_web_plugins/flutter_web_plugins.dart'

276

If you are using an M1 Mac, you can solve the problem like this. Move to /ios, open terminal, and run the following commands:

sudo arch -x86_64 gem install ffi  
arch -x86_64 pod install --repo-update  
Share:
276
thekavak
Author by

thekavak

Updated on November 23, 2022

Comments

  • thekavak
    thekavak over 1 year

    A few days ago I created a new project and it was progressing smoothly. My project broke down while I was trying something new tonight.

    When I couldn't solve it, I wanted to create it from scratch and move it there, but while moving, I realized that there was a problem with the packages I added. These are all the packages in my project that worked fine yesterday.

    version: 1.0.0+1
    
    environment:
      sdk: ">=2.12.0 <3.0.0"
    
    dependencies:
      flutter:
        sdk: flutter
      flutter_web_plugins:
        sdk: flutter
    
    
      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      cupertino_icons: ^1.0.2
      carousel_slider: ^4.0.0
      shared_preferences: ^2.0.6
      line_awesome_flutter: ^2.0.0
      delayed_display: ^2.0.0
      flutter_bounce: ^1.1.0
      auto_size_text: ^3.0.0-nullsafety.0
      swipe: ^0.0.1
    
    dev_dependencies:
      flutter_test:
        sdk: flutter
    
    # For information on the generic Dart part of this file, see the
    # following page: https://dart.dev/tools/pub/pubspec
    
    # The following section is specific to Flutter.
    flutter:
    
      # The following line ensures that the Material Icons font is
      # included with your application, so that you can use the icons in
      # the material Icons class.
      uses-material-design: true
    
      # To add assets to your application, add an assets section, like this:
      assets:
        - assets/onboard/
        - assets/images/
    

    When I add the shared_preferences: ^2.0.6 package, the 'generated_plugin_registrant.dart' page is created and the 'import 'package:flutter_web_plugins/flutter_web_plugins.dart';' glows red.

    At the same time, when I say run in the google fonts package, it gives an error on ios.

    Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
    Running pod install...
    CocoaPods' output:
    ↳
          Preparing
    
        Analyzing dependencies
    
        Inspecting targets to integrate
          Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    
        Fetching external sources
        -> Fetching podspec for `Flutter` from `Flutter`
        -> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`
        [!] Failed to load 'shared_preferences' podspec: 
        [!] Invalid `shared_preferences.podspec` file: undefined method `HomeFrame=' for #<Pod::Specification name="shared_preferences">
        Did you mean?  homepage=.
    
         #  from /Users/thekavak/Desktop/clotie/clotie/ios/.symlinks/plugins/shared_preferences/ios/shared_preferences.podspec:11
         #  -------------------------------------------
         #                         DESC
         >    s.HomeFrame         = 'https://github.com/flutter/plugins'
         #    s.license          = { :type => 'BSD', :file => '../LICENSE' }
         #  -------------------------------------------
    
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/external_sources/abstract_external_source.rb:175:in `rescue in store_podspec'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/external_sources/abstract_external_source.rb:161:in `store_podspec'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/external_sources/path_source.rb:17:in `block in fetch'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/external_sources/path_source.rb:11:in `fetch'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:989:in `fetch_external_source'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:968:in `block (2 levels) in fetch_external_sources'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:967:in `each'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:967:in `block in fetch_external_sources'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:966:in `fetch_external_sources'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:117:in `analyze'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-user-defined-build-types-0.0.7/lib/cocoapods-user-defined-build-types/private_api_hooks.rb:94:in `call'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-user-defined-build-types-0.0.7/lib/cocoapods-user-defined-build-types/private_api_hooks.rb:94:in `block in <class:Installer>'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
        /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
        /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
        /usr/local/bin/pod:23:in `load'
        /usr/local/bin/pod:23:in `<main>'
    
    Error output from CocoaPods:
    ↳
    
        [!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
    
    Error running pod install
    Error launching application on iPhone 12 Pro Max.
    

    All this happened in the new empty project, I just added the packages and it started giving errors without writing anything to the main file.

    All I can think of is that back in the day I had a page in an old project called HomeFrame.dart, could this have broken something? How can I fix this? I will be grateful if you can help me.