text:
Run fails on iOS Simulator.

I'm trying to run my Flutter App on an iOS 14.4 Simulator and it fails with the following exception:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Running Xcode build...
Xcode build done.                                            7.1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    /.../ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /.../ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    /.../ios/Runner/GeneratedPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found
    #import <Flutter/Flutter.h>
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header '/.../Library/Developer/Xcode/DerivedData/Runner-fyllquainthlpefajakayemveuka/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_3RI409TQ1ULEV-clang_1UAU46DUWBS0C.pch' for bridging header '/.../ios/Runner/Runner-Bridging-Header.h'
    /.../ios/Runner/Runner-Bridging-Header.h:1:9: note: in file included from /.../ios/Runner/Runner-Bridging-Header.h:1:
    #import "GeneratedPluginRegistrant.h"
            ^
    2 errors generated.
    <unknown>:0: error: generate-pch command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.

This is the output of flutter doctor -v:
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.1 20C69 darwin-x64, locale en-CA)
    • Flutter version 2.0.1 at /.../Applications/flutter
    • Framework revision c5a4b4029c (4 days ago), 2021-03-04 09:47:48 -0800
    • Engine revision 40441def69
    • Dart version 2.12.0

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /.../Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_HOME = /.../Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin version 54.0.3
    • Dart plugin version 203.7759

[✓] Connected device (4 available)
    • Nokia 3 1 Plus (mobile)    • ROOGAJG930901259                     • android-arm64  • Android 10 (API 29)
    • iPhone 8 Plus (mobile)     • 49B798DC-F25B-47C5-AAAC-3CFA67822316 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • iPhone 12 Pro Max (mobile) • 15D2456A-3E84-4BA1-B579-5E7A4A90AAFA • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 88.0.4324.192

• No issues found!

And my dependencies are the following:
build_runner: ^1.11.5
connectivity: ^3.0.2
crypto: ^3.0.0
cupertino_icons: ^1.0.2
firebase_auth: ^1.0.0
firebase_core: ^1.0.0
firebase_crashlytics: ^1.0.0
firebase_messaging: ^9.0.0
firebase_storage: ^8.0.0
flutter_launcher_icons: ^0.9.0
flutter_native_splash: ^1.0.3
flutter_secure_storage: ^4.0.0
google_fonts: ^2.0.0
http: ^0.13.0
image_picker: ^0.7.2
intl: ^0.17.0
json_annotation: ^4.0.0
json_serializable: ^4.0.2
mqtt_client: ^9.0.0
path_provider: ^2.0.0
pedantic: ^1.11.0
rxdart: ^0.26.0
shared_preferences: ^2.0.3
# soundpool: ^1.1.3
styled_text: ^1.0.3+4
timeago: ^3.0.1
video_player: ^2.0.0
video_compress: ^2.1.1
web_socket_channel: ^1.2.0

The App runs fine on Android, but it fails on iOS. The problem started when I updated Flutter to version 2.0.1. I had tried the following to fix this problem:

Removed ios/Flutter/Flutter.podspec + flutter clean.
pod cache clean --all + pod install --repo-update which installs correctly every dependency to their latest version.

Observations:

platform :ios, '12.0'

Hi @k-zen
Please delete your Podfile and Podfile.lock and then flutter pub get and run the app. Check out https://github.com/flutter/flutter/issues/73855#issuecomment-762126875, similar issue was solved by cleaning your podfile, and removing error causing packages, it requires some investigation on your part since you're using third-party packages
If the problem persists, Can you please provide  flutter run --verbose logs, and a minimal complete reproducible code sample without third-party packages
Thank you

@TahaTesser Removing both Podfile and Podfile.lock didn't worked. I will work on creating a minimal reproducible code sample and post here when done.

Hi @k-zen
It is expected to run into issues if you modify the script, I'm not sure if it is possible to check this beforehand and give a better error message. Comparing with a new project is the best solution in my IMO unless Flutter modifies and causes the issue, which is not the case as you confirmed
Given your last message I feel safe to close this issue, if you disagree please write in the comments and I will reopen it.
Thank you

I had the same problem and it was causes by flagging For install builds only under the Build phases (or the flag runOnlyForDeploymentPostprocessing = 1 in project.pbxproj).
I removed the flag (or set it to 0) and it started working.
This also caused a strange behaviour where when the app started (before getting the error reported in this issue) it shows old content/code.

authors: TahaTesser diegodalbosco k-zen


text:
App fails to build with incorrect "plugin:" section in pubspec.yaml, "flutter build ios" fails with missing GeneratedPluginRegistrant

Steps to Reproduce
I try to build the sentry_flutter example app on the beta channel (2.1.0-12.2.pre) from here https://github.com/getsentry/sentry-dart/tree/main/flutter/example

Checkout repo, navigate to the example.
Run flutter clean
Run flutter build ios --release --no-codesign
It fails with the error message as seen below in Logs

Logs

Logs

example % flutter build ios --no-codesign
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building io.sentry.flutter.example for device (ios-release)...
Upgrading contents.xcworkspacedata
Running pod install...                                           1.961ms
Running Xcode build...
 └─Compiling, linking and signing...                        666ms
Xcode build done.                                           52,3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    /Users/jonas/Documents/projects/sentry-dart/flutter/example/ios/Runner/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found
    #import "GeneratedPluginRegistrant.h"
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header '/Users/jonas/Library/Developer/Xcode/DerivedData/Runner-ctlzmwjnvqpzhveviguiglkeqdnt/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_4FVZ7D3OM2GN-clang_1GXEPMYTXIRGY.pch'
    for bridging header '/Users/jonas/Documents/projects/sentry-dart/flutter/example/ios/Runner/Runner-Bridging-Header.h'
    /Users/jonas/Documents/projects/sentry-dart/flutter/example/ios/Runner/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found
    #import "GeneratedPluginRegistrant.h"
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header '/Users/jonas/Library/Developer/Xcode/DerivedData/Runner-ctlzmwjnvqpzhveviguiglkeqdnt/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_3HSXYR6LG6BL9-clang_1QPC4EPBC31OW.pch'
    for bridging header '/Users/jonas/Documents/projects/sentry-dart/flutter/example/ios/Runner/Runner-Bridging-Header.h'
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

════════════════════════════════════════════════════════════════════════════════
Building a deployable iOS app requires a selected Development Team with a
Provisioning Profile. Please ensure that a Development Team is selected by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

For more information, please visit:
  https://flutter.dev/setup/#deploy-to-ios-devices

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Encountered error while building for device.

jonas@JonasMacBookPro example % flutter --version
Flutter 2.1.0-12.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5bedb7b1d5 (5 days ago) • 2021-03-17 17:06:30 -0700
Engine • revision 711ab3fda0
Tools • Dart 2.13.0 (build 2.13.0-116.0.dev)
jonas@JonasMacBookPro example % flutter doctor -v
[✓] Flutter (Channel beta, 2.1.0-12.2.pre, on macOS 11.2.3 20D91 darwin-x64, locale de-DE)
    • Flutter version 2.1.0-12.2.pre at /Users/jonas/Documents/projects/flutter
    • Framework revision 5bedb7b1d5 (5 days ago), 2021-03-17 17:06:30 -0700
    • Engine revision 711ab3fda0
    • Dart version 2.13.0 (build 2.13.0-116.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/jonas/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Users/jonas/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Users/jonas/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.3)
    • IntelliJ at /Users/jonas/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • iPhone 12 Pro Max (mobile) • 57DFFEAC-3903-449E-8EEF-1F6F3E5A8DC4 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 89.0.4389.90

• No issues found!

It works on Flutter 2.0.3, which is the current stable version.

Hi @ueman
Thanks  for filling the running on the stable, the generated_plugin_registrant.dart file is generated in the lib folder and build is successful too, no errors in the logs
tahatesser@Tahas-MacBook-Pro example % flutter build ios --release --no-codesign
Warning: You are using these overridden dependencies:
! sentry 4.1.0-nullsafety.2 from path ../../dart
! sentry_flutter 4.1.0-nullsafety.2 from path ..
Running "flutter pub get" in example...                            651ms
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building io.sentry.flutter.example for device (ios-release)...
Upgrading contents.xcworkspacedata
Running pod install...                                              7.7s
Running Xcode build...
 └─Compiling, linking and signing...                        20.4s
Xcode build done.                                           78.4s
Built /Users/tahatesser/AndroidStudioProjec

However, on the beta channel, there is generated_plugin_registrant.dart  file in lib folder but the build is still successful and no error is thrown similar to your logs
tahatesser@Tahas-MacBook-Pro example % flutterb build ios --release --no-codesign
Warning: You are using these overridden dependencies:
! sentry 4.1.0-nullsafety.2 from path ../../dart
! sentry_flutter 4.1.0-nullsafety.2 from path ..
Running "flutter pub get" in example...                            668ms
Warning: Building for device with codesigning disabled. You will have to manually codesign before deploying to device.
Building io.sentry.flutter.example for device (ios-release)...
Running pod install...                                           1,862ms
Running Xcode build...
 └─Compiling, linking and signing...                         9.4s
Xcode build done.                                           82.0s
Built /Users/tahatesser/AndroidStudioProjects/sentry-dart/flutter/example/build/ios/iphoneos/Runner.app.
tahatesser@Tahas-MacBook-Pro example %

flutter doctor -v
[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale
    en-GB)
    • Flutter version 2.0.3 at /Users/tahatesser/Code/flutter_stable
    • Framework revision 4d7946a68d (4 days ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 10 (API 29)
    • macOS (desktop)  • macos            • darwin-x64     • macOS 11.2.3 20D91
      darwin-x64
    • Chrome (web)     • chrome           • web-javascript • Google Chrome
      89.0.4389.90

• No issues found!

[✓] Flutter (Channel beta, 2.1.0-12.2.pre, on macOS 11.2.3 20D91 darwin-x64,
    locale en-GB)
    • Flutter version 2.1.0-12.2.pre at /Users/tahatesser/Code/flutter_beta
    • Framework revision 5bedb7b1d5 (5 days ago), 2021-03-17 17:06:30 -0700
    • Engine revision 711ab3fda0
    • Dart version 2.13.0 (build 2.13.0-116.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (3 available)
    • RMX2001 (mobile) • EUYTFEUSQSRGDA6D • android-arm64  • Android 10 (API 29)
    • macOS (desktop)  • macos            • darwin-x64     • macOS 11.2.3 20D91
      darwin-x64
    • Chrome (web)     • chrome           • web-javascript • Google Chrome
      89.0.4389.90

• No issues found!

Are you able to reproduce this locally? instead of CI
Thank you

My issue is not about the generated_plugin_registrant.dart but about the GeneratedPluginRegistrant.h of iOS.
The log in the issue is of a local build with Flutter Beta 2.1.0-12.2.pre.

Please note that GeneratedPluginRegistrant.h and GeneratedPluginRegistrant.m aren't deleted by flutter clean so you might have to delete them manually. They are gitignored by the Flutter template though.

@ueman

So if you build it first on stable and then on beta it works because the GeneratedPluginRegistrant.* are already present.

That's helpful, when running directly on beta, the error is reproduced on beta to master.

logs
tahatesser@Tahas-MacBook-Pro example % flutterb build ios --release --no-codesign
Warning: You are using these overridden dependencies:
! sentry 4.1.0-nullsafety.2 from path ../../dart
! sentry_flutter 4.1.0-nullsafety.2 from path ..
Running "flutter pub get" in example...                            729ms
Warning: Building for device with codesigning disabled. You will have to
manually codesign before deploying to device.
Building com.nevercode.triage for device (ios-release)...
Running pod install...                                           1,957ms
Running Xcode build...
 └─Compiling, linking and signing...                      1,322ms
Xcode build done.                                           51.6s
Failed to build iOS app
Error output from Xcode build:
↳
    2021-03-23 10:39:24.746 xcodebuild[18548:152854]  DVTAssertions: Warning in
    /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-1770
    5/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
    Details:  (null) deviceType from 00008020-001059882212002E was NULL when
    -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7ff6c9eedbf0>
    Method:   -platform
    Thread:   <NSThread: 0x7ff6c745c6f0>{number = 8, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning
    message and any useful information you can provide.
    2021-03-23 10:39:24.951 xcodebuild[18548:152853]  DVTAssertions: Warning in
    /Library/Caches/com.apple.xbs/Sources/DVTiOSFrameworks/DVTiOSFrameworks-1770
    5/DTDeviceKitBase/DTDKRemoteDeviceData.m:371
    Details:  (null) deviceType from 00008020-001059882212002E was NULL when
    -platform called.
    Object:   <DTDKMobileDeviceToken: 0x7ff6c9eedbf0>
    Method:   -platform
    Thread:   <NSThread: 0x7ff6c74541e0>{number = 10, name = (null)}
    Please file a bug at https://feedbackassistant.apple.com with this warning
    message and any useful information you can provide.
    ** BUILD FAILED **

Xcode's output:
↳
    /Users/tahatesser/AndroidStudioProjects/sentry-dart/flutter/example/ios/Runn
    er/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file
    not found
    #import "GeneratedPluginRegistrant.h"
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header
    '/Users/tahatesser/Library/Developer/Xcode/DerivedData/Runner-egetvnnxpqleim
    faktzxabdpmwyc/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridgin
    g-Header-swift_1ORZXO94OG5F6-clang_UFQOLDQKRW0Y.pch' for bridging header
    '/Users/tahatesser/AndroidStudioProjects/sentry-dart/flutter/example/ios/Run
    ner/Runner-Bridging-Header.h'
    /Users/tahatesser/AndroidStudioProjects/sentry-dart/flutter/example/ios/Runn
    er/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file
    not found
    #import "GeneratedPluginRegistrant.h"
            ^
    1 error generated.
    <unknown>:0: error: failed to emit precompiled header
    '/Users/tahatesser/Library/Developer/Xcode/DerivedData/Runner-egetvnnxpqleim
    faktzxabdpmwyc/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridgin
    g-Header-swift_14SM2DMV4BV9N-clang_1M7CLXJX5Y5DO.pch' for bridging header
    '/Users/tahatesser/AndroidStudioProjects/sentry-dart/flutter/example/ios/Run
    ner/Runner-Bridging-Header.h'
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Encountered error while building for device.
tahatesser@Tahas-MacBook-Pro example %

flutter doctor -v
[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale
    en-GB)
    • Flutter version 2.0.3 at /Users/tahatesser/Code/flutter_stable
    • Framework revision 4d7946a68d (4 days ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • def0ad20                  • android-arm64  •
      Android 10 (API 29)
    • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios            • iOS
      14.4.1
    • macOS (desktop)        • macos                     • darwin-x64     •
      macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)           • chrome                    • web-javascript •
      Google Chrome 89.0.4389.90

• No issues found!

[✓] Flutter (Channel beta, 2.1.0-12.2.pre, on macOS 11.2.3 20D91 darwin-x64,
    locale en-GB)
    • Flutter version 2.1.0-12.2.pre at /Users/tahatesser/Code/flutter_beta
    • Framework revision 5bedb7b1d5 (5 days ago), 2021-03-17 17:06:30 -0700
    • Engine revision 711ab3fda0
    • Dart version 2.13.0 (build 2.13.0-116.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • def0ad20                  • android-arm64  •
      Android 10 (API 29)
    • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios            • iOS
      14.4.1
    • macOS (desktop)        • macos                     • darwin-x64     •
      macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)           • chrome                    • web-javascript •
      Google Chrome 89.0.4389.90

• No issues found!

[✓] Flutter (Channel master, 2.1.0-13.0.pre.207, on macOS 11.2.3 20D91
    darwin-x64, locale en-GB)
    • Flutter version 2.1.0-13.0.pre.207 at
      /Users/tahatesser/Code/flutter_master
    • Framework revision 5d37734ea1 (2 hours ago), 2021-03-22 23:30:00 -0700
    • Engine revision d59a01d2d3
    • Dart version 2.13.0 (build 2.13.0-150.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Volumes/Extreme/SDK
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Volumes/Extreme/SDK
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.54.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.20.0

[✓] Connected device (4 available)
    • Redmi K20 Pro (mobile) • def0ad20                  • android-arm64  •
      Android 10 (API 29)
    • Taha’s iPhone (mobile) • 00008020-001059882212002E • ios            • iOS
      14.4.1
    • macOS (desktop)        • macos                     • darwin-x64     •
      macOS 11.2.3 20D91 darwin-x64
    • Chrome (web)           • chrome                    • web-javascript •
      Google Chrome 89.0.4389.90

• No issues found!

My issue is not about the generated_plugin_registrant.dart but about the GeneratedPluginRegistrant.h of iOS.

I'm aware, it's just something I observed between stable and beta since the error wasn't reproduced earlier
Thanks for filing the issue!

I think the sentry example pubspec.yaml is incorrect:
https://github.com/getsentry/sentry-dart/blob/0a5337a03d70ebc9b05b0c87aa092ad4c03c439c/flutter/example/pubspec.yaml#L23-L29
flutter:
  uses-material-design: true
  plugin:
    platforms:
      web:
        pluginClass: ExamplePluginWeb
        fileName: example_plugin_web.dart

https://github.com/getsentry/sentry-dart/pull/205/files#diff-4d384482d6ba9e5b15f6a0e15a21dcd69561dc87823d1621d139d91b612ca6daR21
The plugin part makes the tool process it as a plugin, which doesn't have a GeneratedPluginRegistrant.  This is a weird manifestation of that problem, but it skips the plugin processing because it thinks it's a plugin (and not an app), and then the next step happily continues as if it's an app.
When I change it to:
flutter:
  uses-material-design: true

it builds correctly.
Ideally if the project was a plugin:
https://github.com/flutter/flutter/blob/985fc7463c96a31673c12d3d5d40f466aa30f9f5/packages/flutter_tools/lib/src/project.dart#L224-L225
flutter build ios would fail and tell you that it can't build a plugin.

Thanks! We'll try that solution and let you know if it works.
Though I do wonder why it worked flawlessly before.

Though I do wonder why it worked flawlessly before.

The logic changed with #76406.

The fix as described above works. It is fixed in Sentry as of https://github.com/getsentry/sentry-dart/pull/399

From duplicate https://github.com/flutter/flutter/issues/102029

I guess I'll keep this open since there's nothing stopping users from adding the plugin key, at which point the stale app files like ios are just hanging out, the tool could warn you you're in this state?

Exception: Please correct the pubspec.yaml file at /pubspec.yaml
Error detected in pubspec.yaml:
Error on line 48, column 3: Duplicate mapping key.
╷
48 │   image_picker: ^0.8.2
│   ^^^^^^^^^^^^
This error is been detected`
name: document_wallet
description: A new Flutter project.
The following line prevents the package from being accidentally published to
pub.dev using flutter pub publish. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
The following defines the version and build number for your application.
A version number is three numbers separated by dots, like 1.2.43
followed by an optional build number separated by a +.
Both the version and the builder number may be overridden in flutter
build by specifying --build-name and --build-number, respectively.
In Android, build-name is used as versionName while build-number used as versionCode.
Read more about Android versioning at https://developer.android.com/studio/publish/versioning
In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
Read more about iOS versioning at
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=3.1.0 <4.0.0"
Dependencies specify other packages that your package needs in order to work.
To automatically upgrade your package dependencies to the latest versions
consider running flutter pub upgrade --major-versions. Alternatively,
dependencies can be manually updated by changing the version numbers below to
the latest version available on pub.dev. To see which dependencies have newer
versions available, run flutter pub outdated.
dependencies:
flutter:
sdk: flutter
image_picker: ^0.8.2
The following adds the Cupertino Icons font to your application.
Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
firebase_auth: ^4.14.0
flutter_downloader: ^1.11.5
flutter_feather_icons: ^2.0.0+1
google_sign_in: ^6.1.6
flutter_svg: ^2.0.9
mailer: ^6.0.1
file_picker: ^6.1.1
dotted_border: ^2.1.0
firebase_storage: ^11.5.1
fluttertoast: ^8.2.4
image_picker: ^0.8.2
pinch_zoom: ^2.0.0
dev_dependencies:
flutter_test:
sdk: flutter
The "flutter_lints" package below contains a set of recommended lints to
encourage good coding practices. The lint set provided by the package is
activated in the analysis_options.yaml file located at the root of your
package. See that file for information about deactivating specific lint
rules and activating additional ones.
flutter_lints: ^3.0.1
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/logo.png
- assets/google icon.svg
- images/a_dot_ham.jpeg
An image asset can refer to one or more resolution-specific "variants", see
https://flutter.dev/assets-and-images/#resolution-aware.
For details regarding adding assets from package dependencies, see
https://flutter.dev/assets-and-images/#from-packages
To add custom fonts to your application, add a fonts section here,
in this "flutter" section. Each entry in this list should have a
"family" key with the font family name, and a "fonts" key with a
list giving the asset and other descriptors for the font. For
example:
fonts:
- family: Schyler
fonts:
- asset: fonts/Schyler-Regular.ttf
- asset: fonts/Schyler-Italic.ttf
style: italic
- family: Trajan Pro
fonts:
- asset: fonts/TrajanPro.ttf
- asset: fonts/TrajanPro_Bold.ttf
weight: 700

For details regarding fonts from package dependencies,
see https://flutter.dev/custom-fonts/#from-packages
`

source: gharchive/issue

authors: Adi0559 TahaTesser jmagman ueman

repo: flutter/flutter

license_type: permissive

license_source: github-api


text:
Discourage committing the current composing region when there's an open input connection

I suspect the root cause of the following bugs is that some IMEs make the assumption that the composing region won't get committed by the editor, and the only way to commit the current text is via themselves:

https://github.com/flutter/flutter/issues/72980
https://github.com/flutter/flutter/issues/78066
https://github.com/flutter/flutter/issues/31512 (The Samsung IME duplicate text bug)
https://github.com/flutter/flutter/issues/61097

On iOS you can't easily remove the composing region either (you can't move the selection to somewhere that's not in the composing region).
macOS: you can remove the composing region by left clicking some other text that's not in the composing region. But arrow key movements are still limited within the composing region.
Maybe we should make it difficult to commit the composing region, or even make it difficult to explicitly change the composing region.

On Android, I have also noticed that when this warning is logged, it is typically paired with the log spam described in https://github.com/flutter/flutter/issues/9471. It appears when dragging the caret around. When the warning is logged, the dragging "session" is stopped and the handle disappears.

Maybe we should make it difficult to commit the composing region, or even make it difficult to explicitly change the composing region.

Please don't make anything difficult. Maybe you should, instead, fill a bug in the Android repo?
We need to be able to edit text in the composing region, which in western languages is everything the user has been typing from the previous space (as far as I understand, perhaps I am wrong).
I am getting your warning when I am making text uppercase with a TextInputFormatter:
newValue.copyWith(
            text: newValue.text.capitalize(capitalize),
);

Preventing these changes would completely criple the usefulness of the TextInputFormatter.

I have two different and similar screens that use the same Flutter TextFormField class on a same way. One of them logs on the console the Discourage and the other no.
The discourage is logged on the console when I tap the commit key of the Android's keyboard and there is previously written character. If the TextFormField ist empty, the discourage is not written.

After reading the android docs and some older commits, it looks like on Android after the editor modifies the text it needs to call restartInput. We currently do that when the composing region changes so that should be good enough (we used to restart the input connection whenever the framework changes the input value, but restarting the input method seems to be quite slow). I've changed the error message the android text input plugin emits and downgraded it from "warnning" to "info".

Seeing this issue in stable version 2.2.2 running in emulator.  Any resolution to this?
`flutter doctor -v
[√] Flutter (Channel stable, 2.2.2, on Microsoft Windows [Version 10.0.19043.1052], locale en-US)
• Flutter version 2.2.2 at C:\dev\flutter
• Framework revision d79295af24 (5 days ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at c:\dev\Android\Sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.57.0)
• VS Code at C:\Users\sherw\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[√] Connected device (1 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• No issues found!`

I see this problem when using SearchDelegate and entering text using my physical keyboard with Vysor. Pressing the keyboard keys on screen or with the mouse on the mirrored keyboard on the computer works.
The problem is, that the input after the messages are shown gets completely stuck. No input neither with the physical nor virtual keyboard is possible until the screen is reloaded.
W/TextInputPlugin(14022): Changing the content within the the composing region may cause the input method to behave strangely, and is therefore discouraged. See https://github.com/flutter/flutter/issues/78827 for more details
W/ListenableEditingState(14022): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper(14022): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(14022): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(14022): endBatchEdit on inactive InputConnection

Example code
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: MyHomePage());
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () => showSearch(context: context, delegate: MySearchDelegate()),
      ),
    );
  }
}

class MySearchDelegate extends SearchDelegate<void> {
  @override
  Widget buildLeading(BuildContext context) => Container();

  @override
  List<Widget> buildActions(BuildContext context) => [];

  @override
  Widget buildSuggestions(BuildContext context) => Container();

  @override
  Widget buildResults(BuildContext context) => Container();
}

I see this problem when using SearchDelegate and entering text using my physical keyboard with Vysor. Pressing the keyboard keys on screen or with the mouse on the mirrored keyboard on the computer works.
The problem is, that the input after the messages are shown gets completely stuck. No input neither with the physical nor virtual keyboard is possible until the screen is reloaded.

Today, I had the same problem using Vysor.
I only put a simple TextFormField in HelloWorld Project and after enter 2 characters, from my keyboard to Vysor, the app stop enter keys to input.

M1 Mac
Android Emulator
Unable to add more then two characters on any input field. Then this shows in console:
Meanwhile works fine on real device.
W/TextInputPlugin( 4006): Changing the content within the the composing region may cause the input method to behave strangely, and is therefore discouraged. See https://github.com/flutter/flutter/issues/78827 for more details
W/ListenableEditingState( 4006): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper( 4006): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 4006): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 4006): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 4006): endBatchEdit on inactive InputConnection

I'm experiencing this problem as well but I think in a different case. I created a new Flutter app and I'm trying to set an initial value in a TextField widget using a process I've used before in several Flutter apps. Whenever I edit content in the field, the Android Studio Run window displays:
W/TextInputPlugin(18696): Changing the content within the the composing region may cause the input method to behave strangely, and is therefore discouraged. See https://github.com/flutter/flutter/issues/78827 for more details
W/IInputConnectionWrapper(18696): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(18696): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(18696): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(18696): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(18696): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(18696): endBatchEdit on inactive InputConnection

To validate that it wasn't something weird in my app, I created a new, clean app with just a Text widget and the TextEdit widget and I still get the same issue. I'm not doing anything except setting the default value. Ultimately I want to capture changes to the input field and write the value to local storage, but I thought I'd fix this input error first.
Here's the code for my test app:
import 'package:flutter/material.dart';

const appName = 'TextField Test';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: appName,
      debugShowCheckedModeBanner: false,
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      home: HomePage(title: appName),
    );
  }
}

class HomePage extends StatefulWidget {
  HomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  late TextEditingController textEditingController;
  String _inputValue = '';

  @override
  void initState() {
    super.initState();
    textEditingController = TextEditingController(text: _inputValue);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: Padding(
          padding: const EdgeInsets.all(10.0),
          child:
              Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
            Text('This is some content in a Text widget'),
            SizedBox(height: 10),
            TextField(
              autofocus: true,
              decoration: InputDecoration(
                  border: OutlineInputBorder(),
                  hintText: 'Enter some text here'),
              controller: textEditingController,
            ),
          ]),
        ));
  }
}

When I add a listener to the controller, I noticed that its firing multiple times for every character I type on the keyboard:
I/flutter (18696): Listener fired the e
I/flutter (18696): Listener fired the e
I/flutter (18696): Listener fired the en
I/flutter (18696): Listener fired the en

Here's the listener code:
 @override
  void initState() {
    super.initState();
    textEditingController = TextEditingController(text: _inputValue);
    textEditingController.addListener(() {
      print('Listener fired ${textEditingController.text}');
    });
  }

In my app, the field is supposed to capture an API key, so I have a little batch file that sets it for me and I've used it many times before in an older Flutter app:
adb shell input text <<my_api_token>>

When I run this command, only a couple of characters of the poked value make it into the field (about 4 out of 20). Something's different; the input field's bogged down by something.
The warning message in the console points me to this Issue, but there's no solution or work-around here that I can find, so I'm not sure why the warning pointed me here. From what I can see, several people are getting these warnings in different conditions but in my case, the input field's simply broken.
Can someone please help me understand what I have to change in my app to make these warnings go away and the input field work the way I expect it to work (the way it worked in Flutter 1.x)?

this error occured on me when i try to write a text into TextFormField in my Computer's keyboard instead of virtual keyboard of emulator device.

same issue on editing TextFormFields, this code used to work fine before, so I suspect this issue got introduced in one of the more recent updates?

this error occured on me when i try to write a text into TextFormField in my Computer's keyboard instead of virtual keyboard of emulator device.

Same here. Virtual keyboard works fine until I use the physical keyboard of the computer.

Same here. I can only type 4 characters. Is there any workaround here?

Same issue. Would be great to see a workaround for this!

Same issue, Not able to enter more than 2 letters from physical keyboard.
Upgraded flutter from 2.2 to 2.3, Still issue is not resolved.

Problem description:
Since flutter 2.2.0 this error results in a strange behavior with the TextInputFormatter:
Using an IBAN Formatter which adds a whitespace every 4 character, results in changing the keyboardType back to default after the whitespace is added.
As Iban is using Alphabetic and Numeric characters, depending on the Country, forcing an Input Type is not reccomende!
How to Reproduce:

Build the TestCode on an Android Device
Type in the Country Code (DE for Example)
Change KeyboardStyle to Numbers
Type in 3 Numbers (123)
after typing the 3rd Number the KeyboardStyle changes back to default Keyboard Style

CONSOLE OUTPUT:
I/HwSecImmHelper(14293): mSecurityInputMethodService is null
I/TextInputPlugin(14293): Composing region changed by the framework. Restarting the input method.
W/InputMethodManager(14293): startInputReason = 3
W/ListenableEditingState(14293): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper(14293): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(14293): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(14293): getTextBeforeCursor on inactive InputConnection

FLUTTER DOCTOR:
testing_shit flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale de-DE)
    • Flutter version 2.2.3 at /Users/mhein/workspace/flutter
    • Framework revision f4abaa0735 (17 hours ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc4)
    • Android SDK at /Users/mhein/Library/Android/sdk
    • Platform android-30, build-tools 31.0.0-rc4
    • ANDROID_SDK_ROOT = /Users/mhein/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.57.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (4 available)
    • ANE LX1 (mobile)                 • 9WV4C18810003333          • android-arm64  • Android 8.0.0 (API 26)
    • iPhone von Annika Oeste (mobile) • 00008020-00016C321E99002E • ios            • iOS 14.4
    • macOS (desktop)                  • macos                     • darwin-x64     • macOS 11.4 20F71 darwin-x64
    • Chrome (web)                     • chrome                    • web-javascript • Google Chrome 91.0.4472.114

• No issues found!

TEST CODE:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextField(
            autofocus: true,
            inputFormatters: [CustomInputFormatter()],
            decoration: InputDecoration(
              fillColor: Colors.grey[200],
              filled: true,
              labelText: "IBAN",
            ),
          ),
        ),
      ),
    );
  }
}

class CustomInputFormatter extends TextInputFormatter {
  @override
  TextEditingValue formatEditUpdate(
      TextEditingValue oldValue, TextEditingValue newValue) {
    var text = newValue.text;
    text = text.replaceAll(" ", "").toUpperCase();

    int offset = newValue.selection.start;
    var subText = newValue.text.substring(0, offset).replaceAll(" ", "");
    int realTrimOffset = subText.length;

    var buffer = new StringBuffer();
    for (int i = 0; i < text.length; i++) {
      buffer.write(text[i]);
      var nonZeroIndex = i + 1;
      if (nonZeroIndex % 4 == 0 && nonZeroIndex != text.length) {
        buffer.write(' ');
      }

      if (nonZeroIndex % 4 == 0 &&
          subText.length == nonZeroIndex &&
          nonZeroIndex > 4) {
        int moveCursorToRigth = nonZeroIndex ~/ 4 - 1;
        realTrimOffset += moveCursorToRigth;
      }

      if (nonZeroIndex % 4 != 0 && subText.length == nonZeroIndex) {
        int moveCursorToRigth = nonZeroIndex ~/ 4;
        realTrimOffset += moveCursorToRigth;
      }
    }

    var string = buffer.toString();
    return newValue.copyWith(
      text: string,
      selection: new TextSelection.collapsed(offset: realTrimOffset),
    );
  }
}

For me it's working now after changing the below line of code in the LabeledTextFormField Class :
  // Previous code
  onFieldSubmitted: onChanged!(controller!.text),

// Updated code
 onFieldSubmitted: (value) => onChanged!(value), ```

Hope it's helpful 🙏

I also encounter these warnings when restoring text set on the TextFields from previous session.

Problem description:
Since flutter 2.2.0 this error results in a strange behavior with the TextInputFormatter:
Using an IBAN Formatter which adds a whitespace every 4 character, results in changing the keyboardType back to default after the whitespace is added.
As Iban is using Alphabetic and Numeric characters, depending on the Country, forcing an Input Type is not recomended!
How to Reproduce:

Build the TestCode on an Android Device
Type in the Country Code (DE for Example)
Change KeyboardStyle to Numbers
Type in 3 Numbers (123)
after typing the 3rd Number the KeyboardStyle changes back to default Keyboard Style

CONSOLE OUTPUT:
I/HwSecImmHelper(14293): mSecurityInputMethodService is null
I/TextInputPlugin(14293): Composing region changed by the framework. Restarting the input method.
W/InputMethodManager(14293): startInputReason = 3
W/ListenableEditingState(14293): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper(14293): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(14293): getExtractedText on inactive InputConnection
W/IInputConnectionWrapper(14293): getTextBeforeCursor on inactive InputConnection

FLUTTER DOCTOR:
testing_shit flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale de-DE)
    • Flutter version 2.2.3 at /Users/mhein/workspace/flutter
    • Framework revision f4abaa0735 (17 hours ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc4)
    • Android SDK at /Users/mhein/Library/Android/sdk
    • Platform android-30, build-tools 31.0.0-rc4
    • ANDROID_SDK_ROOT = /Users/mhein/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.57.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.23.0

[✓] Connected device (4 available)
    • ANE LX1 (mobile)                 • 9WV4C18810003333          • android-arm64  • Android 8.0.0 (API 26)
    • iPhone von **** (mobile)     • 00008020-00016C321E99002E • ios            • iOS 14.4
    • macOS (desktop)                  • macos                     • darwin-x64     • macOS 11.4 20F71 darwin-x64
    • Chrome (web)                     • chrome                    • web-javascript • Google Chrome 91.0.4472.114

• No issues found!

TEST CODE:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextField(
            autofocus: true,
            inputFormatters: [CustomInputFormatter()],
            decoration: InputDecoration(
              fillColor: Colors.grey[200],
              filled: true,
              labelText: "IBAN",
            ),
          ),
        ),
      ),
    );
  }
}

class CustomInputFormatter extends TextInputFormatter {
  @override
  TextEditingValue formatEditUpdate(
      TextEditingValue oldValue, TextEditingValue newValue) {
    var text = newValue.text;
    text = text.replaceAll(" ", "").toUpperCase();

    int offset = newValue.selection.start;
    var subText = newValue.text.substring(0, offset).replaceAll(" ", "");
    int realTrimOffset = subText.length;

    var buffer = new StringBuffer();
    for (int i = 0; i < text.length; i++) {
      buffer.write(text[i]);
      var nonZeroIndex = i + 1;
      if (nonZeroIndex % 4 == 0 && nonZeroIndex != text.length) {
        buffer.write(' ');
      }

      if (nonZeroIndex % 4 == 0 &&
          subText.length == nonZeroIndex &&
          nonZeroIndex > 4) {
        int moveCursorToRigth = nonZeroIndex ~/ 4 - 1;
        realTrimOffset += moveCursorToRigth;
      }

      if (nonZeroIndex % 4 != 0 && subText.length == nonZeroIndex) {
        int moveCursorToRigth = nonZeroIndex ~/ 4;
        realTrimOffset += moveCursorToRigth;
      }
    }

    var string = buffer.toString();
    return newValue.copyWith(
      text: string,
      selection: new TextSelection.collapsed(offset: realTrimOffset),
    );
  }
}

We are having similar issues with using input formatters. However, instead of changing the keyboard type, it stops accepting new characters.
@Menelphor you should now use keyboard type numbers for IBANs since they can contain alphabetic characters as well.

Still no solution about this?
https://github.com/flutter/flutter/issues/78827#issuecomment-867969406
Im getting the same problem here... When a textField is on Focus I get this lines printed on terminal if Im using android:
Changing the content within the the composing region may cause the input method to behave strangely, and is therefore discouraged. See https://github.com/flutter/flutter/issues/78827 for more details
W/IInputConnectionWrapper( 7463): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 7463): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 7463): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 7463): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 7463): endBatchEdit on inactive InputConnection
but on iOS nothing is printed on my terminal
The app used in this example is very simple => https://github.com/flutter/flutter/issues/78827#issuecomment-867969406
the last comment was 19 days ago... what is going on?

Not sure if this has been posted before but if you click on the keyboard settings of the virtual keyboard and turn it off you can use your physical keyboard it seems:

any update in this regard?

Suddenly got this issue today.
Any solution???

Closing since this should no longer be a problem on Android as we always restart the input method on composing region changes. For iOS it's being tracked at https://github.com/flutter/flutter/issues/79844.

@LongCatIsLooong the problem is not fixed. Please do not make assumptions before closing an issue that a lot of people are having trouble with. I provided a complete sample above that you can use to validate your assumption before closing the issue. I just ran it and the issue persists:
I/flutter ( 6938): Listener fired t
I/flutter ( 6938): Listener fired t
I/flutter ( 6938): Listener fired th
I/flutter ( 6938): Listener fired th
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired th
I/chatty  ( 6938): uid=10155(com.johnwargo.textfield_test) 1.ui identical 1 line
I/flutter ( 6938): Listener fired th
I/flutter ( 6938): Listener fired thi
I/flutter ( 6938): Listener fired thi
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired thi
I/flutter ( 6938): Listener fired thi
I/flutter ( 6938): Listener fired thi
I/flutter ( 6938): Listener fired this
I/flutter ( 6938): Listener fired this
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this
I/chatty  ( 6938): uid=10155(com.johnwargo.textfield_test) 1.ui identical 1 line
I/flutter ( 6938): Listener fired this
I/flutter ( 6938): Listener fired this
I/flutter ( 6938): Listener fired this
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this i
I/flutter ( 6938): Listener fired this i
I/flutter ( 6938): Listener fired this is
I/flutter ( 6938): Listener fired this is
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this is
I/flutter ( 6938): Listener fired this is
I/flutter ( 6938): Listener fired this is
I/flutter ( 6938): Listener fired this is
I/flutter ( 6938): Listener fired this is
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this is a
I/flutter ( 6938): Listener fired this is a
I/flutter ( 6938): Listener fired this is a
I/flutter ( 6938): Listener fired this is a
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this is a t
I/flutter ( 6938): Listener fired this is a t
I/flutter ( 6938): Listener fired this is a te
I/flutter ( 6938): Listener fired this is a te
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this is a te
I/flutter ( 6938): Listener fired this is a te
I/flutter ( 6938): Listener fired this is a te
I/flutter ( 6938): Listener fired this is a tes
I/flutter ( 6938): Listener fired this is a tes
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
I/flutter ( 6938): Listener fired this is a tes
I/flutter ( 6938): Listener fired this is a tes
I/flutter ( 6938): Listener fired this is a tes
I/flutter ( 6938): Listener fired this is a test
I/flutter ( 6938): Listener fired this is a test
I/TextInputPlugin( 6938): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 6938): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 6938): endBatchEdit on inactive InputConnection
I/flutter ( 6938): Listener fired this is a test
I/chatty  ( 6938): uid=10155(com.johnwargo.textfield_test) 1.ui identical 1 line
I/flutter ( 6938): Listener fired this is a test

The listener fires multiple times for every character input.
It doesn't do it on a physical device and the IInoputConnectionWrapper messages only end up on the console once:
Launching lib\main.dart on Pixel 5 in debug mode...
Running Gradle task 'assembleDebug'...
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
W/FlutterActivityAndFragmentDelegate(23441): A splash screen was provided to Flutter, but this is deprecated. See flutter.dev/go/android-splash-migration for migration steps.
Debug service listening on ws://127.0.0.1:53174/Y1pFAtLihNk=/ws
Syncing files to device Pixel 5...
I/flutter (23441): Listener fired
W/IInputConnectionWrapper(23441): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(23441): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper(23441): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper(23441): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper(23441): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(23441): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(23441): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(23441): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper(23441): endBatchEdit on inactive InputConnection
I/flutter (23441): Listener fired t
I/flutter (23441): Listener fired th
I/flutter (23441): Listener fired thi
I/flutter (23441): Listener fired this
I/flutter (23441): Listener fired this
I/flutter (23441): Listener fired this i
I/flutter (23441): Listener fired this is
I/flutter (23441): Listener fired this is
I/flutter (23441): Listener fired this is a
I/flutter (23441): Listener fired this is a
I/flutter (23441): Listener fired this is a t
I/flutter (23441): Listener fired this is a te
I/flutter (23441): Listener fired this is a tes
I/flutter (23441): Listener fired this is a test

The duplicate listener fires are for the space key I pressed between words.

@johnwargo ah sorry for the confusion, this was originally a proposal to discourage developers from making composing region changes in the framework onChanged callback (or in a TextInputFormatter) to prevent some soft keyboards to behave unexpectedly (and the "restarting input method" error message was added to the android text input plugin for that purpose).
But it turns out the Android text input plugin was not calling restartInput when the developer changes the text at that time (this has since been fixed), so the limitation actually doesn't apply on Android, and most input methods should work fine even after a composing region change.
This proposal is no longer needed so I'm going to keep the issue closed. Please file a new issue if you're experiencing problems with the onscreen keyboard.

@Menelphor

Using an IBAN Formatter which adds a whitespace every 4 character, results in changing the keyboardType back to default after the whitespace is added.
It seems in your formatter you're removing the current composing region:

    return newValue.copyWith(
      text: string,
      selection: new TextSelection.collapsed(offset: realTrimOffset),
    );

according to the Android documentation, the input method needs to be restarted when the text is modified by the input formatter, and that could be the reason the keyboard layout resets. But since currently we only restart when the composing region changes, you might be able to avoid the input method restart by specifying the composing region in the return value of the input formatter and keep it the same as the oldValue. This is apparently only a workaround but I don't really have a better idea for solving the problem right now.

@johnwargo the repro code you provided isn't modifying the input state (for example, using a TextInputFormatter or change the controller's value in the TextField.onChanged callback. So basically the text field just passively receives updates from the software keyboard), in theory it shouldn't have the composing region problem. I ran the code on my test device and didn't see anything strange. Is that behavior consistent? It could be caused by a data race between the platform and the framework.
As for the double listener notification (which unfortunately I couldn't reproduce either), it shouldn't happen but 2 input states are not necessarily considered "equal" if they contain identical text.

authors: Adrek DarkMikey Djihanegh GaryQian HaardikBhagtani Kuroiteiken LongCatIsLooong Menelphor Nerdyvedi SherwinJames aruizcanton danielGz gabriel-xavier jaibyron johnwargo lauroboeniatcamaelion marcglasberg omatt sebastianbuechler sukhcha-in unlockdev yulkin2002


text:
A custom route that inherits OverlayRoute, will the OverlayEntry of this route be rebuilt when it is pushed or popped?

When pushing from Two() to Three(), why is Two() rebuilt (print ‘TwoWidget build’’)?
And when pop from Three() to Two(), why is Two() also rebuilt (print ‘TwoWidget build’’)?
How to prevent it from being rebuilt?

minimal code sample
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _MyApp();
  }
}

class _MyApp extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Material(
        child: FlutterTest(),
      ),
    );
  }
}

class FlutterTest extends StatefulWidget {
  @override
  _FlutterTestState createState() => _FlutterTestState();
}

class _FlutterTestState extends State<FlutterTest> {
  @override
  void initState() {
    super.initState();
    print('one init');
  }

  @override
  Widget build(BuildContext context) {
    print('one build');
    return Center(
      child: TextButton(
        child: const Text('to two'),
        onPressed: () {
          Navigator.of(context).push(Two());
        },
      ),
    );
  }
}

class Two extends OverlayRoute<void> {
  @override
  Iterable<OverlayEntry> createOverlayEntries() {
    return <OverlayEntry>[
      OverlayEntry(
        builder: (_) {
          return TwoWidget();
        },
      ),
    ];
  }
}

class TwoWidget extends StatefulWidget {
  @override
  _TwoWidgetState createState() => _TwoWidgetState();
}

class _TwoWidgetState extends State<TwoWidget> {
  @override
  void initState() {
    super.initState();
    print('TwoWidget init');
  }

  @override
  Widget build(BuildContext context) {
    print('TwoWidget build');
    return Center(
      child: TextButton(
        onPressed: () {
          Navigator.push(context, MaterialPageRoute<void>(builder: (BuildContext context) => Three()));
        },
        child: const Text('to three'),
      ),
    );
  }
}

class Three extends StatefulWidget {
  @override
  _ThreeState createState() => _ThreeState();
}

class _ThreeState extends State<Three> {
  @override
  void initState() {
    super.initState();
    print('three init');
  }

  @override
  Widget build(BuildContext context) {
    print('three build');
    return Center(
      child: TextButton(
        child: const Text('three'),
        onPressed: () {},
      ),
    );
  }
}

flutter doctor -v:
PS D:\homestead\jysp> flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19042.985], locale zh-CN)
    • Flutter version 2.2.1 at D:\flutter
    • Framework revision 02c026b03c (8 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\10338\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.56.2)
    • VS Code at C:\Users\10338\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 90.0.4430.212
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 90.0.818.42

• No issues found!

Hi @ddxl123
Please check https://flutter.dev/docs/release/breaking-changes/overlay-entry-rebuilds
If the problem persists Can you please provide your flutter doctor -v,
Thank you

flutter doctor -v:
PS D:\homestead\jysp> flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19042.985], locale zh-CN)
    • Flutter version 2.2.1 at D:\flutter
    • Framework revision 02c026b03c (8 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\10338\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.56.2)
    • VS Code at C:\Users\10338\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 90.0.4430.212
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 90.0.818.42

• No issues found!

Hi @ddxl123
Please check https://flutter.dev/docs/release/breaking-changes/overlay-entry-rebuilds
If the problem persists Can you please provide your flutter doctor -v?
Thank you

PS D:\homestead\jysp> flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.19042.985], locale zh-CN)
    • Flutter version 2.2.1 at D:\flutter
    • Framework revision 02c026b03c (8 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\10338\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.56.2)
    • VS Code at C:\Users\10338\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 90.0.4430.212
    • Edge (web)                         • edge          • web-javascript • Microsoft Edge 90.0.818.42

• No issues found!

Hi @ddxl123
Did you try the changes from https://flutter.dev/docs/release/breaking-changes/overlay-entry-rebuilds? You need to setState based on the docs
If the problem persists, can you please provide a complete reproducible minimal code sample with the changes
Thank you

Hi @ddxl123
Did you try the changes from https://flutter.dev/docs/release/breaking-changes/overlay-entry-rebuilds? You need to setState based on the docs
If the problem persists, can you please provide a complete reproducible minimal code sample with the changes
Thank you

Still have problems,The reproduction code is already written on it.https://github.com/flutter/flutter/issues/83889#issue-910525907

Hi @ddxl123
I've recreated your code sample with the changes mentioned in the docs, it returns an object so I've cast it as a string, the widget still rebuilds. I think the documentation needs an update.
Here is my sample

minimal code sample
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      theme: ThemeData.dark(),
      initialRoute: '/',
      routes: {
        // When navigating to the "/" route, build the FirstScreen widget.
        '/': (context) => Home(),
        // When navigating to the "/second" route, build the SecondScreen widget.
        '/floating': (context) => FloatingMessage(),
        '/second': (context) => SecondScreen(),
      },
    );
  }
}

class Home extends StatefulWidget {
  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  void initState() {
    super.initState();
    print('Home-init');
  }

  @override
  Widget build(BuildContext context) {
    print('Home-build');
    return Scaffold(
      appBar: AppBar(
        title: Text('Material App Bar'),
      ),
      body: Center(
        child: TextButton(
          child: const Text('Go to Floating'),
          onPressed: () {
            Navigator.of(context).push(MyOverlayRoute());
          },
        ),
      ),
    );
  }
}

class MyOverlayRoute extends OverlayRoute<void> {
  @override
  Iterable<OverlayEntry> createOverlayEntries() {
    return <OverlayEntry>[
      OverlayEntry(builder: (_) {
        return FloatingMessage();
      }),
    ];
  }
}

class FloatingMessage extends StatefulWidget {
  const FloatingMessage({Key? key}) : super(key: key);

  @override
  _FloatingMessageState createState() => _FloatingMessageState();
}

class _FloatingMessageState extends State<FloatingMessage> {
  String buttonLabel = 'Go to SecondScreen';

  @override
  void initState() {
    super.initState();
    print('FloatingMessage-init');
  }

  @override
  Widget build(BuildContext context) {
    print('FloatingMessage-build');

    return Center(
      child: ElevatedButton(
        onPressed: () async {
        final newLabel = await Navigator.pushNamed(context, '/second') as String;
          setState(() {
          buttonLabel = newLabel;
        });
        },
        child: Text(buttonLabel),
      ),
    );
  }
}

class SecondScreen extends StatefulWidget {
  const SecondScreen({Key? key}) : super(key: key);

  @override
  _SecondScreenState createState() => _SecondScreenState();
}

class _SecondScreenState extends State<SecondScreen> {
  @override
  void initState() {
    super.initState();
    print('SecondScreen-init');
  }

  @override
  Widget build(BuildContext context) {
    print('SecondScreen-build');
    return Center(
      child: TextButton(
        child: const Text('SecondScreen'),
        onPressed: () {},
      ),
    );
  }
}

is there any update?Im using cache_image plugin in A page and navigate to B page, A page will rebuild and refade in the image.

authors: ManInTheWind TahaTesser ddxl123


text:
useRootNavigator is not working with Navigator 2.0

useRootNavigator is not working with Navigator 2.0
For example:
 OpenContainer(
              useRootNavigator: true,
              routeSettings: const RouteSettings(
                name: Routes.SecondPage,
              ),
        .....

the URL is not changing on open the container
also it's not working with anything has useRootNavigator property
Flutter Doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, 2.2.3, on Microsoft Windows [Version 10.0.19043.1151], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.59.1)
[√] Connected device (3 available)
• No issues found!

Hi @AbdallahR99 Thanks for filing the issue, Please share a minimal and complete reproducible code to better address the issue
Thanks

@maheshmnj
Here:
https://github.com/AbdallahR99/nav2issue
as simple example with openContainer and dialog
is using the useRootNavigator  but it's not working the url is not changing

@AbdallahR99 I see that you are using a third-party plugin get for routing could you please try removing the third-party plugin and see if that fixes the issue and the issue persists, feel free to write back with the updated code sample.
Thanks.

Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of flutter doctor -v.
All system setups can be slightly different, so it's always better to open new issues and reference related issues.

authors: AbdallahR99 TahaTesser maheshmnj