Les
Les

Reputation: 71

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

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

Upvotes: 6

Views: 3590

Answers (5)

René Lazo
René Lazo

Reputation: 671

Steps to solve your problem:

  1. First Of all, You Need To Update all Third-party Packages

    flutter pub upgrade --major-versions

  2. Now You need to clean your project

    flutter clean

  3. Delete "pubspec.lock" file at the root of your project (manually or run the script)

    rm -rf pubspec.lock

  4. Now, You need to Get all Packages

    flutter pub get

Now you can run your project and the error should be solved ;)

Upvotes: 2

SahilSelfmade
SahilSelfmade

Reputation: 1

Downgrade flutter to the previous version "flutter downgrade" until an upgrade to flutter 3.0.0 is provided by the owners of all packages you are using in your project.

Upvotes: 0

  1. Step 1: Delete pod folder in ios.

  2. Step 2: uncomment the code at the line # platform :ios, '9.0' in Podfile.

  3. Step 3: change line platform :ios, '9.0' to platform :ios, '10.0'

  4. Step 4: run : flutter pub upgrade

  5. Step 5: cd ios , run pod install

  6. Step 6: run pod repo update and sudo gem install cocoapods and run again pod repo update and run pod install

    Step 7: run again project . goodluck

Upvotes: 1

Andriy Antonov
Andriy Antonov

Reputation: 1510

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 🎉

Upvotes: 3

Huthaifa Muayyad
Huthaifa Muayyad

Reputation: 12343

Delete the build folder, run flutter clean. I had the same problem with a macOS project and had to delete the macOs folder. Works fine afterwards.

Upvotes: 0

Related Questions