Code debugging in Flutter mixed development mode

As we all know, when doing Flutter development, it has its own hot reload/hot restart function. However, you may find that when we access the Flutter module in the native project, the hot reload/hot restart seems to be both If it fails, how can I use hot reload/hot restart in a mixed project, and how to implement code debugging in a mixed project?

Before introducing these, let's take a look at the native access to the Flutter module. For students who don't know how to access, you can refer to the following article: FlutterFragment for Flutter Hybrid Development and Native Android Project Access to Flutter aar .

First, we open an Android emulator or connect a real machine. Close our app and run the flutter attachcommand . flutter attach can be launched through different paths, such as through the command line tools in the SDK, VS Code or IntelliJ/Android Studio.

flutter attachYou can connect as soon as you run the FlutterEngine and stay connected until the FlutterEngine is released. You can do this before starting the engine flutter attachand it will wait for the next Dart VM held by the engine to connect.

It should be noted that when using hybrid development and debugging, you need to use the source code to introduce flutter_module, and then run it on the terminal first flutter attach, and then run the native Android code.

Guess you like

Origin blog.csdn.net/xiangzhihong8/article/details/122479029