The following is provided you have a mixed development project up and running

When we developed the Flutter project, it had a hot restart/reload function. However, when we integrated the Flutter project into the Android project in the mixed development, the hot restart/hot load function of the Flutter project did not work well. The debug function of the Flutter project also did not work well. Here’s how to solve both problems

Start hot restart/reload mode

  • Open an emulator, or connect a device to a computer
  • Close app, kill in background, then run Flutter Attach;
flutter attach
Waiting for a connection from Flutter on AOSP on IA Emulator...
Copy the code

If there are multiple emulators starting up, the system will let you select one to run. We need the flutter attach -D to specify a device

  • And then go back to the Android project and run the app and then go back to the Flutter project and you’ll see

  • R: Hot loading
  • R: Hot restart
  • H: Get help
  • D: Disconnect

Enable the debug mode to debug the Dart code

  • The first thing to do is close the app and kill it in the background
  • Then go back to the Flutter project and click the Flutter Attach button in AndroidStudio (need to install the Flutter and Dart plugin first).

  • Go back to your Android project and run your app

Rome wasn’t built in a day! Come on SAO year!