Unable to build iOS or Android app after upgrade to Flutter 3.0

341

So, something which helped me:

  1. remove the next folder /Users/your-user/.pub-cache/hosted/pub.dartlang.org
  2. hit flutter pub upgrade

and then try to run your project 🎉

Share:
341
Les
Author by

Les

Updated on January 04, 2023

Comments

  • Les
    Les over 1 year

    After upgrading to Flutter 3.0 I am no longer able to build any of my apps for either iOS or Android and get the same errors in both builds:

    : Error: Member not found: 'UnicodeChar'.
      int get UnicodeChar => Char.UnicodeChar;
                                  ^^^^^^^^^^^
    : Error: Setter not found: 'UnicodeChar'.
      set UnicodeChar(int value) => Char.UnicodeChar = value;
    
                                         ^^^^^^^^^^^
    : Error: Member not found: 'AsciiChar'.
      int get AsciiChar => Char.AsciiChar;
                                ^^^^^^^^^
    : Error: Setter not found: 'AsciiChar'.
      set AsciiChar(int value) => Char.AsciiChar = value;
    
                                       ^^^^^^^^^
    

    and these errors are in the file "src/structs.g.dart" (part of Flutter/Dart as far as I can tell) as follows:

    /// {@category Struct}
    class _CHAR_INFO__Char_e__Union extends Union {
      @Uint16()
      external int UnicodeChar;
      @Uint8()
      external int AsciiChar;
    }
    
    extension CHAR_INFO_Extension on CHAR_INFO {
      int get UnicodeChar => Char.UnicodeChar;
      set UnicodeChar(int value) => Char.UnicodeChar = value;
    
      int get AsciiChar => Char.AsciiChar;
      set AsciiChar(int value) => Char.AsciiChar = value;
    }
    

    I am running VSCode 1.67.1 on macOS Monterey 12.3.1 and flutter doctor -v shows no errors found.

    It appears that the file "src/structs.g.dart" seems to be part of the Win32 components in "pub.dartlang.org" but I am not building my apps for Windows (yet).

    Any ideas on what I need to do to be able to build for iOS and Android again will be much appreciated.

    Thanks

    Les

  • Les
    Les almost 2 years
    I deleted the build folder and ran flutter clean but it made no difference (I am still getting the same errors)...
  • Ermindo Lopes
    Ermindo Lopes almost 2 years
    same here.. errors persist... and Flutter doctor show Visual Studio Error - Exception: Bad UTF-8 encoding (U+FFFD; REPLACEMENT CHARACTER) found while decoding string
  • Les
    Les almost 2 years
    Hi Andriy, On its own that did not work but after then running flutter pub upgrade it is now all good. Many thanks.
  • Andriy Antonov
    Andriy Antonov almost 2 years
    Awesome :) glad to help. please if you don't mind - accept the answer
  • Hoàng Anh Chung
    Hoàng Anh Chung almost 2 years
    Flow step below :