search
HomeBackend DevelopmentPython TutorialThis article will help you understand Flutter's hot deployment

This article will help you understand Flutter's hot deployment

About the running method in Dart

  • JIT: Just In Time. Dynamic interpretation, translation and execution at the same time, also called just-in-time compilation, such as JavaScript, Python, etc., used in the development cycle, can dynamically issue and execute code, and the development and testing efficiency is high, but the running speed and performance will be affected. Hot reloading in Flutter is based on this feature
  • AOT : Ahead of Time. Static compilation means that the program is translated into machine code before execution, and is compiled in advance, such as C, C, OC, etc. When using AOT during the release period, there is no need to combine cross-platform JavaScript code and native code like RN. Establish inefficient method call mapping relationships between Android and iOS codes.

The running mode of the program has no mandatory relationship with the specific language. For example, python can be either JIT or AOT. Dart is one of the few languages ​​that supports both JIT and AOT.

Dart uses JIT during the development process. Every change does not need to be compiled into bytecode, which saves a lot of time. During deployment, AOT is used to generate efficient ARM code to ensure efficient performance, so Dart It has the characteristics of fast running speed and good execution performance.

Hot Reload

Modify the string "Hello, World" in the Dart code file, add an exclamation mark, and click the save or hot refresh button to immediately update the interface. On, it only takes a few hundred milliseconds:

This article will help you understand Flutter's hot deployment

Flutter injects new code into the running DartVM. To achieve the magical effect of Hot Reload, after DartVM completes updating the class structure in the program, Flutter will immediately rebuild the entire control tree to update the interface. However, hot refresh also has some limitations. Not all code changes can be updated through hot refresh:

  1. Compilation error, if the modified Dart The code cannot be compiled, and Flutter will report an error in the console. In this case, the corresponding code needs to be modified.
  2. Conversion of control type from StatelessWidget to StatefulWidget , because Flutter will retain the original state of the program when performing hot refresh, and changing a control from stageless→stateful will cause Flutter to report an error "myWidget is not a subtype of StatelessWidget" when recreating the control, while changing from stateful→stateless will cause an error " type 'myWidget' is not a subtype of type 'StatefulWidget' of 'newWidget'".
  3. Global variables and static member variables, these variables will not be updated during hot refresh.
  4. Modified the root control node created in the main function. After hot refresh, Flutter will only re-create the control tree based on the original root node and will not modify the root. node.
  5. If a class is converted from a common type to an enumeration type, or the type's generic parameter list changes, hot refresh will fail.

When hot refresh fails to update, perform a hot restart (Hot Restart) to fully update all codes. There is also no need to restart the App. The difference Yes restart will synchronize all Dart code packages to the device, and all status will be reset.

The above is the detailed content of This article will help you understand Flutter's hot deployment. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:51CTO.COM. If there is any infringement, please contact admin@php.cn delete
Python: A Deep Dive into Compilation and InterpretationPython: A Deep Dive into Compilation and InterpretationMay 12, 2025 am 12:14 AM

Pythonusesahybridmodelofcompilationandinterpretation:1)ThePythoninterpretercompilessourcecodeintoplatform-independentbytecode.2)ThePythonVirtualMachine(PVM)thenexecutesthisbytecode,balancingeaseofusewithperformance.

Is Python an interpreted or a compiled language, and why does it matter?Is Python an interpreted or a compiled language, and why does it matter?May 12, 2025 am 12:09 AM

Pythonisbothinterpretedandcompiled.1)It'scompiledtobytecodeforportabilityacrossplatforms.2)Thebytecodeistheninterpreted,allowingfordynamictypingandrapiddevelopment,thoughitmaybeslowerthanfullycompiledlanguages.

For Loop vs While Loop in Python: Key Differences ExplainedFor Loop vs While Loop in Python: Key Differences ExplainedMay 12, 2025 am 12:08 AM

Forloopsareidealwhenyouknowthenumberofiterationsinadvance,whilewhileloopsarebetterforsituationswhereyouneedtoloopuntilaconditionismet.Forloopsaremoreefficientandreadable,suitableforiteratingoversequences,whereaswhileloopsoffermorecontrolandareusefulf

For and While loops: a practical guideFor and While loops: a practical guideMay 12, 2025 am 12:07 AM

Forloopsareusedwhenthenumberofiterationsisknowninadvance,whilewhileloopsareusedwhentheiterationsdependonacondition.1)Forloopsareidealforiteratingoversequenceslikelistsorarrays.2)Whileloopsaresuitableforscenarioswheretheloopcontinuesuntilaspecificcond

Python: Is it Truly Interpreted? Debunking the MythsPython: Is it Truly Interpreted? Debunking the MythsMay 12, 2025 am 12:05 AM

Pythonisnotpurelyinterpreted;itusesahybridapproachofbytecodecompilationandruntimeinterpretation.1)Pythoncompilessourcecodeintobytecode,whichisthenexecutedbythePythonVirtualMachine(PVM).2)Thisprocessallowsforrapiddevelopmentbutcanimpactperformance,req

Python concatenate lists with same elementPython concatenate lists with same elementMay 11, 2025 am 12:08 AM

ToconcatenatelistsinPythonwiththesameelements,use:1)the operatortokeepduplicates,2)asettoremoveduplicates,or3)listcomprehensionforcontroloverduplicates,eachmethodhasdifferentperformanceandorderimplications.

Interpreted vs Compiled Languages: Python's PlaceInterpreted vs Compiled Languages: Python's PlaceMay 11, 2025 am 12:07 AM

Pythonisaninterpretedlanguage,offeringeaseofuseandflexibilitybutfacingperformancelimitationsincriticalapplications.1)InterpretedlanguageslikePythonexecuteline-by-line,allowingimmediatefeedbackandrapidprototyping.2)CompiledlanguageslikeC/C transformt

For and While loops: when do you use each in python?For and While loops: when do you use each in python?May 11, 2025 am 12:05 AM

Useforloopswhenthenumberofiterationsisknowninadvance,andwhileloopswheniterationsdependonacondition.1)Forloopsareidealforsequenceslikelistsorranges.2)Whileloopssuitscenarioswheretheloopcontinuesuntilaspecificconditionismet,usefulforuserinputsoralgorit

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version