Flutter application updating method, device, equipment and storage medium
By compiling cross-platform intermediate bytecode files, the problem of insufficient hot update capability of the Flutter framework is solved, realizing seamless full hot update, applicable to multiple platforms, improving user experience and reducing version management and maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIBABA (CHINA) CO LTD
- Filing Date
- 2022-01-30
- Publication Date
- 2026-04-10
AI Technical Summary
The Flutter framework's lack of hot update capability forces users to manually install the application package for a full upgrade, making incremental upgrades impossible, which affects user experience, and also results in high version management and maintenance costs for cross-platform applications.
By obtaining intermediate bytecode files with cross-platform capabilities, and using the terminal's pre-installed backend compiler to compile them into binary files specific to a particular platform, hot updates can be achieved, reducing the complexity of the release process and maintenance costs.
It enables full hot updates without user intervention, is applicable to multiple platforms, improves user experience, and reduces version management and maintenance costs.
Smart Images

Figure CN114529066B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, in particular to a Flutter application updating method, a corresponding Flutter application updating device, a corresponding electronic device and a computer storage medium. BACKGROUND
[0002] The Flutter cross-platform application framework (an open-source cross-platform application development framework) can implement a set of codes to support mobile terminals, desktop terminals and Web terminals at the same time. Usually, computer client desktop versions and mobile terminal versions of applications need to be implemented at the same time, which are mainly developed and implemented based on the Flutter cross-platform framework.
[0003] However, the Flutter framework with cross-platform characteristics has weak hot updating capability. When the Flutter application implemented based on the Flutter framework is updated, the user needs to manually install the application installation package, which not only needs user intervention but also performs full upgrade and cannot perform incremental upgrade, which does not meet the service experience of user non-perception upgrade. SUMMARY
[0004] In view of the above problems, the present application is proposed to provide a Flutter application updating method, a corresponding Flutter application updating device, a corresponding electronic device and a computer storage medium which overcome the above problems or at least partially solve the above problems.
[0005] The present application discloses a Flutter application updating method, which comprises:
[0006] An intermediate bytecode file with cross-platform characteristics is obtained through a terminal where the Flutter application is located; the intermediate bytecode file is used to update the Flutter application;
[0007] A backend compiler preinstalled in the terminal where the Flutter application is located is used to compile the intermediate bytecode file with cross-platform characteristics to obtain a binary file corresponding to the terminal where the Flutter application is located;
[0008] The binary file is executed to update the Flutter application.
[0009] Optionally, the intermediate bytecode file with cross-platform characteristics is obtained through the terminal where the Flutter application is located, which comprises:
[0010] The intermediate bytecode file for updating the Flutter application is pulled from the server by a background service process of a terminal where the Flutter application is located in a time manner; and the server is configured to receive an intermediate bytecode file compiled from a Dart source code file for updating the Flutter application.
[0011] Optionally, the intermediate bytecode file comprises signature information, and the intermediate bytecode file with the cross-platform feature is obtained by the terminal where the Flutter application is located, comprising:
[0012] The intermediate bytecode file of the new version is pulled from the server according to the signature information by the background service process of the terminal where the Flutter application is located.
[0013] Optionally, the backend compiler preinstalled in the terminal where the Flutter application is located has a platform identifier, and the intermediate bytecode file with the cross-platform feature is compiled by the backend compiler preinstalled in the terminal where the Flutter application is located to obtain a binary file corresponding to the terminal where the Flutter application is located, comprising:
[0014] The intermediate bytecode file is compiled into a binary file corresponding to the platform identifier by using the preinstalled backend compiler, so as to conform to the binary file specific to the terminal platform where the Flutter application is located.
[0015] Optionally, the method further comprises:
[0016] The binary file obtained after the compilation is stored in a backup directory of the Flutter application, and the backup directory is configured to be loaded when an installation directory of the Flutter application is occupied.
[0017] Optionally, the binary file is executed to update the Flutter application, comprising:
[0018] In response to a start instruction and / or a restart instruction of the Flutter application, a binary file in an installation directory of the Flutter application is loaded to start the Flutter application, so as to update the Flutter application.
[0019] Optionally, the binary file in the installation directory of the Flutter application is loaded to start the Flutter application, comprising:
[0020] A new version of the binary file existing in the backup directory of the Flutter application is obtained, and the new version of the binary file is overwritten to an old version of the binary file in the installation directory of the Flutter application.
[0021] At the start of the Flutter application, the binary file of the new version in the installation directory is executed to load the updated Flutter application.
[0022] The embodiments of the present application also disclose an updating device of a Flutter application, which comprises:
[0023] an intermediate bytecode file obtaining module located in a terminal where the Flutter application is located, used for obtaining an intermediate bytecode file with cross-platform characteristics; the intermediate bytecode file is used for updating the Flutter application;
[0024] an intermediate bytecode file compiling module located in a preset backend compiler of the terminal where the Flutter application is located, used for compiling the intermediate bytecode file with cross-platform characteristics to obtain a binary file corresponding to the terminal where the Flutter application is located;
[0025] an application updating module, used for executing the binary file to update the Flutter application.
[0026] Optionally, the intermediate bytecode file obtaining module comprises:
[0027] an intermediate bytecode file obtaining submodule, used for pulling the intermediate bytecode file for updating the Flutter application from a server through a background service process of the terminal where the Flutter application is located; the server is used for receiving an intermediate bytecode file obtained by compiling a Dart source code file used for updating the Flutter application.
[0028] Optionally, the intermediate bytecode file comprises signature information, and the intermediate bytecode file obtaining module comprises:
[0029] the intermediate bytecode file obtaining submodule is further used for pulling the intermediate bytecode file of a new version from the server according to the signature information through the background service process of the terminal where the Flutter application is located.
[0030] Optionally, the preset backend compiler of the terminal where the Flutter application is located has a platform identifier, and the intermediate bytecode file compiling module comprises:
[0031] an intermediate bytecode file compiling submodule, used for compiling the intermediate bytecode file into a binary file corresponding to the platform identifier by using the preset backend compiler, so as to conform to a binary file specific to a platform of the terminal where the Flutter application is located.
[0032] Optionally, the intermediate bytecode file compiling module further comprises:
[0033] The intermediate bytecode file storage submodule is configured to store the obtained binary file after compilation to a backup directory of the Flutter application, and the backup directory is configured to be loaded when an installation directory of the Flutter application is occupied.
[0034] Optionally, the application updating module comprises:
[0035] The application updating submodule is configured to load a binary file in the installation directory of the Flutter application to start the Flutter application in response to a start instruction and / or a restart instruction of the Flutter application, so as to update the Flutter application.
[0036] Optionally, the application updating submodule comprises:
[0037] The binary file covering unit is configured to obtain a new version of binary file existing in the backup directory of the Flutter application, and cover the new version of binary file to an old version of binary file in the installation directory of the Flutter application.
[0038] The binary file executing unit is configured to execute the new version of binary file in the installation directory to load the updated Flutter application when the Flutter application is started.
[0039] The embodiments of the present application also disclose an electronic device, comprising a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of any of the Flutter application updating methods.
[0040] The embodiments of the present application also disclose a computer readable storage medium, wherein a computer program is stored in the computer readable storage medium, and the computer program, when executed by a processor, implements the steps of any of the Flutter application updating methods.
[0041] The embodiments of the present application have the following advantages:
[0042] In the embodiment of the present application, the intermediate bytecode with cross-platform characteristics is issued, and the Flutter application pulls the new version of the intermediate bytecode and compiles the intermediate bytecode of the Flutter application into a binary file of a specific platform, so as to execute the binary file corresponding to the platform of the terminal where the Flutter application is located through the Flutter application, thereby realizing the hot update of the Flutter application. By updating the Flutter application through the intermediate bytecode with cross-platform characteristics, only one intermediate file needs to be maintained, which can be applied to the Flutter application update of any platform, and the intermediate bytecode of the Flutter application can be compiled into a binary file of a specific platform by using the user's use environment, so that the software can be dynamically upgraded on the user's operating system without user intervention, and the full hot update of the Flutter application source code is realized. BRIEF DESCRIPTION OF DRAWINGS
[0043] Figure 1 is a step flow chart of an embodiment of a Flutter application update method of the present application;
[0044] Figure 2 is a step flow chart of another embodiment of a Flutter application update method of the present application;
[0045] Figure 3 is a flowchart of the Flutter application update method provided by the embodiment of the present application;
[0046] Figure 4 is an application scenario diagram of the Flutter application update provided by the embodiment of the present application;
[0047] Figure 5 is a structural block diagram of an embodiment of a Flutter application update device of the present application. DETAILED DESCRIPTION
[0048] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0049] Flutter cross-platform application framework can implement a set of codes to support mobile terminal, desktop terminal and Web terminal at the same time. Usually, computer client desktop version and mobile terminal version of an application need to be implemented at the same time, which is mainly developed and implemented based on the Flutter cross-platform framework. However, for the application update developed by the Flutter framework, it cannot be directly loaded to the new updated function when the user refreshes the browser after the code is published to the server, like the Web terminal code. When there is a new version of the Flutter application, the user needs to manually install the application installation package, and the full version is published through the fixed period of client software. This updating method cannot meet the needs of the rapid expansion of the application service, cannot meet the rapid iteration of the Flutter application service, and cannot meet the quick development and release of the new version code. At the same time, the full version of the software installation package upgrade needs the user to perform forced installation package upgrade, which greatly interferes with the user experience of the application product.
[0050] The Flutter application can be an application developed and published based on the Flutter framework. In the related technology of Flutter application update, one way is to update by downloading and replacing the Flutter binary compilation product. It mainly obtains the binary product of the new version of Flutter from the server and stores it in the backup directory, so that the application can obtain the new Flutter compilation product from the backup directory when it starts again, and cover the old version of the compilation product to update the Flutter application. This scheme has complete dynamics and can completely implement the hot update of the entire Flutter code on the user side. However, the binary compilation product of Flutter used in this scheme has platform relevance, for example, the product of the Android terminal cannot be directly used for the Flutter application in the IOS terminal. In the case that the client platform of the Flutter application is more, it is necessary to prepare a specific version of binary file for each platform and push it separately, which not only increases the version management and maintenance cost, but also complicates the application release process.
[0051] The other is to update based on the way of building a dynamic UI component of a page, which mainly converts a React component that needs to be mapped into an abstract syntax tree (AST), obtains a component tag node in the AST, and obtains component information under the component tag node, maps the component information into Flutter component information, and dynamically issues the Flutter component information to the application at runtime. This scheme has cross-platform characteristics and can meet the needs of adapting all desktop and mobile terminals with one scheme, but the dynamic updating of this scheme is limited, and it can only realize hot updating of the UI interface, and cannot realize hot updating of service logic and non-UI code logic. In addition, this scheme also needs to use a background system to complete the mapping of React components to Flutter components, that is, an additional background system needs to be introduced, which increases the cost of implementing this scheme.
[0052] Based on the disadvantages of the above related technologies, the embodiments of the present application propose a method for hot updating the production environment code of a Flutter application, that is, a method for hot updating the code of the software use environment of real users, which makes up for the lack of official Flutter framework application that does not support hot updating of the code of the application production environment. The so-called hot updating refers to updating the application without manually installing the application package by the user, but incrementally updating at runtime to achieve the purpose of updating the software.
[0053] One of the core ideas of the embodiments of the present application is to directly push the intermediate bytecode file of the Flutter application to the user side based on the intermediate bytecode with cross-platform porting characteristics, which has unified cross-platform characteristics, and can be applied to the hot updating of the Flutter application on all platforms by only maintaining an update package of the intermediate bytecode file. The intermediate bytecode of the Flutter application can be compiled into a binary file of a specific platform by using the user's use environment, the compilation task of the binary file is put into the user's use environment, the pressure and investment cost of the server are reduced, the effect of application hot updating is achieved without introducing an additional background system, the user's non-perception upgrade is realized, and the product experience of the client is improved.
[0054] Referring to Figure 1 , a step flowchart of an embodiment of a Flutter application updating method of the present application is shown, which can specifically include the following steps:
[0055] Step 101, obtaining an intermediate bytecode file with cross-platform characteristics through a terminal where a Flutter application is located;
[0056] In an embodiment of the present application, the update of the Flutter application can be implemented based on the acquisition of the intermediate bytecode with cross-platform porting characteristics. The cross-platform characteristics of the intermediate bytecode file can be manifested as corresponding different execution files for different platforms. The intermediate bytecode file can be executed cross-platform and is not limited by the characteristics of each platform.
[0057] In a specific implementation, for the intermediate bytecode file with cross-platform characteristics, there are a development stage and a use stage. In the development stage, the process of compiling Dart source code into intermediate bytecode is mainly manifested. The hot reloading mode of the Flutter application in the development environment is mainly implemented by dynamically loading the intermediate bytecode. At this time, the hot reloading mode in the development environment can be customized and modified through the intermediate bytecode file and applied to the user production environment.
[0058] The obtained intermediate bytecode file with cross-platform characteristics is mainly obtained by compiling the source code executable by the Flutter application. The source code executable by the Flutter application used for compiling can be related code for full update of the Flutter application. The compiled intermediate bytecode file has the function of updating the Flutter application. In order to facilitate the convenient release of the version update code and meet the applicability of multiple client platforms, the source code can be compiled into an intermediate bytecode file, so that it has unified cross-platform characteristics.
[0059] In actual application, when the bytecode is used, the intermediate bytecode file with cross-platform characteristics can be directly pushed to the application side of the terminal where the Flutter application is located. Based on the cross-platform characteristics of the intermediate bytecode file, the intermediate bytecode file received by the terminal where the Flutter application is located can be applied to any platform, such as application hot update of PC and mobile terminal. In the case of only maintaining one intermediate bytecode file, the complexity of the release process of the Flutter application is reduced, and the maintenance cost of the application update file is reduced.
[0060] Step 102, compile the intermediate bytecode file with cross-platform characteristics through the backend compiler preset by the terminal where the Flutter application is located to obtain a binary file corresponding to the terminal where the Flutter application is located;
[0061] The obtained intermediate bytecode file has cross-platform characteristics, but in the Release mode of the Flutter application, it cannot be directly executed by the Flutter application, that is, the hot update of the production environment of the Flutter application cannot be implemented through the intermediate bytecode file. At this time, the intermediate bytecode file needs to be compiled into a binary file type executable by the terminal platform, that is, the file with cross-platform characteristics is specialized according to a specific platform.
[0062] In an embodiment of the present application, in the process of compiling the intermediate bytecode file, in order to realize the subsequent hot update of the Flutter application installed on the platform, the intermediate bytecode file needs to be compiled into a file conforming to the characteristics of the terminal platform where the application is located, that is, the file needs to be compiled to obtain a binary file corresponding to the terminal where the Flutter application is located.
[0063] In actual application, the user's operating system environment can be mainly used to preinstall the user's operating system related backend compiler tool in the software installation package, and the intermediate bytecode of the Flutter application is compiled into a binary file of a specific platform by using the user's usage environment, so as to achieve the effect of application hot update.
[0064] Step 103, updating the Flutter application by executing the binary file.
[0065] After the file with cross-platform characteristics is specialized according to the specific platform, the terminal where the Flutter application is located can directly execute the binary file conforming to its platform and capable of execution to complete the update of the Flutter application.
[0066] Specifically, it can be manifested as starting / restarting the Flutter application after starting / restarting the Flutter application by loading the new version of the binary file, so as to realize the hot update of the Flutter application without user awareness.
[0067] The cache directory of the Flutter application is usually provided with two directories, namely the installation directory and the backup directory, wherein the installation directory can be the home directory, and the two directories provided can be used to store the Flutter product, that is, the compiled binary file, and the backup directory can be mainly used to cache the intermediate bytecode file issued by the server. The startup of the Flutter application is mainly based on the binary file in the installation directory, so at this time it can be mainly manifested as starting the Flutter application based on the new version of the binary file existing in the installation directory.
[0068] In the embodiments of the present application, the intermediate bytecode with cross-platform characteristics is issued, and the Flutter application pulls the new version of the intermediate bytecode and compiles the intermediate bytecode of the Flutter application into a binary file of a specific platform, so as to execute the binary file corresponding to the platform of the terminal where the Flutter application is located, thereby realizing hot updating of the Flutter application. By updating the Flutter application through the intermediate bytecode with cross-platform characteristics, only one intermediate file needs to be maintained, which can be applied to Flutter application updating of any platform, and the intermediate bytecode of the Flutter application can be compiled into a binary file of a specific platform by using the user's use environment, so that the software can be dynamically upgraded on the user's operating system without user intervention, thereby realizing full hot updating of the Flutter application source code.
[0069] With reference to Figure 2 , a step flowchart of another embodiment of the updating method of the Flutter application of the present application is shown, which can specifically include the following steps:
[0070] In step 201, the intermediate bytecode file with cross-platform characteristics is obtained from the server by the background service process of the terminal where the Flutter application is located.
[0071] In an embodiment of the present application, the updating of the Flutter application can be realized based on the acquisition of the intermediate bytecode with cross-platform transplantation characteristics, which can be mainly realized by the background service process of the terminal where the Flutter application is located to obtain from the server.
[0072] In actual application, the obtained intermediate bytecode file is a compiled file uploaded by the development end to the server, and the intermediate bytecode file is mainly a file compiled based on the Dart source code file used to update the Flutter application, wherein the Dart source code file is a source code file for service logic updating of the Flutter application, which is a code executable by the Flutter application.
[0073] Specifically, with reference to Figure 3, shows a flowchart of the updating method of the Flutter application provided in the embodiments of the present application. The development end can compile the written Dart source code (i.e. Dart Code) into an intermediate bytecode file kernel_snapshot that can support cross-platform transplantation. The intermediate bytecode is independent of the platform and can be seamlessly transplanted across platforms. The kernel_snapshot.dill file is an intermediate bytecode file specific to the Dart language, which can also support cross-platform transplantation. The hot-reloading mode of the Flutter application in the development environment is achieved by means of the intermediate bytecode kernel_snapshot. At this time, the hot-reloading mode of the Flutter application in the development environment can be achieved by means of the compiled intermediate bytecode file, and the compiled intermediate bytecode file kernel_snapshot is signed, packaged and compressed and then uploaded to the server, so that the server pushes this intermediate bytecode file to any platform where the Flutter application is located. This intermediate bytecode file is a cross-platform transplantation characteristic intermediate bytecode. For different platforms with corresponding different execution files, this intermediate bytecode file can be executed across platforms and is not limited by the characteristics of each platform. That is, in the case of only maintaining one intermediate bytecode file, the complexity of the release process of the Flutter application is reduced, and the maintenance cost of the application update file is reduced.
[0074] The intermediate bytecode file uploaded to the server has signature information, which can carry the update version number, update time, file upload time, etc. of the code. When obtaining the intermediate bytecode file with cross-platform characteristics from the server, the intermediate bytecode file updated for the Flutter application can be pulled from the server by the background service process of the terminal where the Flutter application is located at regular intervals, and the new version of the intermediate bytecode file can be pulled from the server according to the signature information at regular intervals.
[0075] In actual application, during the process of starting the Flutter software, the background service process such as the DartService process can be started to communicate with the server and pull the intermediate bytecode file matching the new version at regular intervals. When starting, the application background service process can perform a package update checking process, which mainly checks whether there is a new version of the intermediate bytecode file on the server. The checking can be based on the version information and compression time of the binary file in the signature information to determine whether the new version is the same as the newly released version of the software. When it is determined that there is a new version of the intermediate bytecode file, the new kernel_snapshot.dill file (i.e. binary file) can be downloaded.
[0076] Step 202: compiling the intermediate bytecode file into a binary file corresponding to the platform identifier by using a preset backend compiler;
[0077] The obtained intermediate bytecode file has cross-platform characteristics, but in the Release mode of the Flutter application, it cannot be directly executed by the Flutter application, that is, hot updating of the production environment of the Flutter application cannot be achieved through the intermediate bytecode file, and at this time, the intermediate bytecode file needs to be compiled into a binary file type that can be executed by the terminal platform, that is, the file with cross-platform characteristics is specialized according to a specific platform.
[0078] Specifically, the terminal where the Flutter application is located is pre-installed with a backend compiler corresponding to the platform identifier, for example, the pre-installed backend compiler tool gen_snapshot has a platform identifier corresponding to a specific platform of the terminal. After downloading the new kernel_snapshot.dill intermediate bytecode file, the intermediate bytecode file can be compiled into a binary file app.so corresponding to the platform identifier by using the pre-installed backend compiler, so as to conform to the binary file specific to the terminal platform where the Flutter application is located, and to achieve updating of the Flutter application according to the generated binary file.
[0079] Step 203: store the compiled binary file to the backup directory of the Flutter application;
[0080] The cache directory of the Flutter application is usually provided with two directories, namely an installation directory and a backup directory. The installation directory can be the home directory, and the two directories provided can be used to store Flutter products, which refer to the compiled binary files. The backup directory can be mainly used to cache the intermediate bytecode file issued by the server. The startup of the Flutter application is mainly based on the binary file in the installation directory. When the Flutter application is in a startup state, the installation directory of the Flutter application is used by the application. At this time, the obtained new version of the Flutter product (that is, the binary file app.so) can be stored in the backup directory to prepare for the next startup of the Flutter application.
[0081] Step 204: load the binary file to update the Flutter application when the Flutter application is restarted.
[0082] After the file with cross-platform characteristics is specialized according to a specific platform, the terminal where the Flutter application is located can directly execute the binary file that meets the platform and can be executed, and the update of the Flutter application is completed. The startup of the Flutter application is mainly based on the binary file in the installation directory, at this time, the startup instruction and / or restart instruction of the Flutter application can be responded, the binary file in the installation directory of the Flutter application is loaded to start the Flutter application, and the Flutter application is updated.
[0083] Specifically, since the binary file of the new version is saved in the backup directory of the Flutter application at the last startup of the Flutter application, the binary file app.so of the new version in the backup directory needs to be pulled and moved to the installation directory when the application is restarted, so as to start the Flutter application based on the installation directory.
[0084] When the Flutter application is restarted, it can be checked whether the binary file of the new version exists in the backup directory, if it exists, the old version binary file in the installation directory can be replaced by the binary file of the new version, and the binary file in the backup directory is deleted, then the determination of whether the binary file of the new version exists in the backup directory can be realized by checking whether the binary file exists in the backup directory.
[0085] In a specific implementation, the binary file of the new version existing in the backup directory of the Flutter application can be obtained, and the binary file of the new version is overwritten to the binary file of the old version in the installation directory of the Flutter application, so that when the Flutter application is started, the binary file of the new version in the installation directory can be executed to load the updated Flutter application, and the hot update of the code of the Flutter application is completed.
[0086] Referring to Figure 4 , an application scenario of Flutter application update provided by an embodiment of the present application is shown, which involves a development end 401, a server end 402 and a platform 403 where the Flutter application is located. The updated Flutter application can include Flutter application 1 and Flutter application 2, and the platform 403 where the Flutter application is located can include platform 1 where the Flutter application 1 is located, platform 2 where the Flutter application 1 is located, and platform 2 where the Flutter application 2 is located. Platform 1 and platform 2 are different platforms. That is, this application scenario can be a scenario of updating the same / different Flutter application on the same / different platform.
[0087] Specifically, the developer can write Dart source code for updating the Flutter application at the development end 401, which can not only write Dart source code 1 for updating the Flutter application 1, but also write Dart source code 2 for updating the Flutter application 2. At this time, the Dart source code 1 for updating the Flutter application 1 and the Dart source code 2 for updating the Flutter application 2 can be compiled into intermediate bytecode files with cross-platform characteristics, such as kernel_snapshot.dill files, respectively. Then, the compiled intermediate bytecode files for updating the Flutter application 1 and the Flutter application 2, respectively, can be uploaded to the server 402 via the development end 401 for pulling and loading by the platform where the Flutter application is located, so as to complete the updating of the corresponding Flutter application on different platforms. The compiled intermediate bytecode files have cross-platform characteristics. The intermediate bytecode file 1 for updating the Flutter application 1 and the intermediate bytecode file 2 for updating the Flutter application 2 uploaded by the development end each have only one copy.
[0088] The platform 1 where the Flutter application 1 is located, the platform 2 where the Flutter application 1 is located, and the platform 2 where the Flutter application 2 is located can all pull the intermediate bytecode file for updating the installed Flutter application based on the background service process of the server 402 in time, mainly the intermediate bytecode file for updating the installed Flutter application, to update the new version. Specifically, the platform 1 where the Flutter application 1 is located and the platform 2 where the Flutter application 1 is located can obtain the new version of the intermediate bytecode file 1 for the Flutter application 1 when pulling in time, at this time the platform 1 can use the backend compiler 1 that is preset and consistent with the platform 1 to compile the new version of the intermediate bytecode file 1 for the Flutter application 1 into a binary file consistent with the platform 1 to be loaded and updated when the Flutter application 1 is restarted on the platform 1, and the platform 2 can also use the backend compiler 2 that is preset and consistent with the platform 2 to compile the new version of the intermediate bytecode file 1 for the Flutter application 2 into a binary file consistent with the platform 2 to be loaded and updated when the Flutter application 2 is restarted on the platform 2; and for the updating and loading process of the platform 2 to the Flutter application 2, when the new version of the intermediate bytecode file 2 for updating the Flutter application 2 is pulled in time, at this time the backend compiler 2 preset in the platform 2 can be used to compile it into a binary file for updating the new version of the Flutter application 2, and the preset backend compiler is consistent with the platform characteristics, so whether the platform 2 updates the Flutter application 1 or the Flutter application 2, the same backend compiler can be used.
[0089] That is, in the scenario of updating the same / different Flutter application on the same / different platform at the same time, only one intermediate bytecode file for updating the same Flutter application needs to be maintained, and the maintained intermediate bytecode file has cross-platform characteristics. The intermediate bytecode file can be compiled into a binary file consistent with the platform characteristics by the compiler of different platforms when used and updated on different platforms.
[0090] In the embodiment of the present application, the intermediate bytecode with cross-platform characteristics is issued, and the Flutter application pulls the new version of the intermediate bytecode and compiles the intermediate bytecode of the Flutter application into a binary file of a specific platform, so as to execute the binary file corresponding to the platform of the terminal where the Flutter application is located, thereby realizing hot updating of the Flutter application. The Flutter application is updated by using the intermediate bytecode with cross-platform characteristics, and only one intermediate file needs to be maintained, so that the Flutter application updating of any platform can be applied, and the intermediate bytecode of the Flutter application can be compiled into a binary file of a specific platform by using the use environment of the user, so that the software can be dynamically upgraded on the operating system of the user without user intervention, and full hot updating of the source code of the Flutter application is realized.
[0091] It should be noted that, for the method embodiments, in order to simply describe, they are all described as a series of action combinations, but those skilled in the art should know that the embodiments of the present application are not limited by the action order described, because according to the embodiments of the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions involved are not necessarily necessary for the embodiments of the present application.
[0092] Referring to Figure 5 , a structural block diagram of an updating device for Flutter application is shown, which can specifically include the following modules:
[0093] The intermediate bytecode file acquisition module 501 is located in the terminal where the Flutter application is located, and is used to acquire an intermediate bytecode file with cross-platform characteristics; the intermediate bytecode file is used to update the Flutter application;
[0094] The intermediate bytecode file compilation module 502 is located in the backend compiler preinstalled in the terminal where the Flutter application is located, and is used to compile the intermediate bytecode file with cross-platform characteristics to obtain a binary file corresponding to the terminal where the Flutter application is located;
[0095] The application updating module 503 is used to execute the binary file to update the Flutter application.
[0096] In an embodiment of the present application, the intermediate bytecode file acquisition module 501 can include the following sub-modules:
[0097] The intermediate bytecode file obtaining submodule is configured to periodically pull the intermediate bytecode file for updating the Flutter application from the server through a background service process of a terminal where the Flutter application is located; and the server is configured to receive the intermediate bytecode file compiled from the Dart source code file for updating the Flutter application.
[0098] In an embodiment of the present application, the intermediate bytecode file comprises signature information, and the intermediate bytecode file obtaining module 501 can comprise the following submodule:
[0099] The intermediate bytecode file obtaining submodule is further configured to pull the intermediate bytecode file of the new version from the server according to the signature information through the background service process of the terminal where the Flutter application is located.
[0100] In an embodiment of the present application, the backend compiler pre-installed in the terminal where the Flutter application is located has a platform identifier, and the intermediate bytecode file compiling module 502 can comprise the following submodule:
[0101] The intermediate bytecode file compiling submodule is configured to compile the intermediate bytecode file into a binary file corresponding to the platform identifier by using the pre-installed backend compiler, so as to conform to the terminal platform-specific binary file of the Flutter application.
[0102] In an embodiment of the present application, the intermediate bytecode file compiling module 502 can further comprise the following submodule:
[0103] The intermediate bytecode file storing submodule is configured to store the binary file obtained after the compilation into a backup directory of the Flutter application, and the backup directory is configured to be used when the installation directory of the Flutter application is occupied.
[0104] In an embodiment of the present application, the application updating module 503 can comprise the following submodule:
[0105] The application updating submodule is configured to load the binary file in the installation directory of the Flutter application to start the Flutter application in response to a start instruction and / or a restart instruction of the Flutter application, so as to update the Flutter application.
[0106] In an embodiment of the present application, the application updating submodule can comprise the following unit:
[0107] The binary file covering unit is configured to obtain the binary file of the new version existing in the backup directory of the Flutter application, and cover the binary file of the new version to the binary file of the old version in the installation directory of the Flutter application.
[0108] a binary file execution unit, configured to execute the binary file of the new version in the installation directory to load the updated Flutter application when the Flutter application is started.
[0109] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts are referred to the part of the method embodiment.
[0110] The embodiment of the application further provides an electronic device, comprising:
[0111] The computer program is stored in the memory and can be run on the processor, and when the computer program is executed by the processor, each process of the method embodiment for updating the Flutter application is realized, and the same technical effects can be achieved. To avoid repetition, details are not described here.
[0112] The embodiment of the application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, each process of the method embodiment for updating the Flutter application is realized, and the same technical effects can be achieved. To avoid repetition, details are not described here.
[0113] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the difference from other embodiments. The same and similar parts between each embodiment are referred to each other.
[0114] Those skilled in the art should understand that the embodiments of the application can be provided as a method, device, or computer program product. Therefore, the embodiments of the application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the application can be in the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0115] The embodiments of the application are described with reference to flowcharts and / or block diagrams according to the method, terminal device (system), and computer program product of the embodiments of the application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of the flows and / or blocks in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the computer or other programmable data processing terminal device produce a machine that implements the functions described in the flowchart and / or block diagram.Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0116] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0117] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0118] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0119] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0120] The above provides a detailed introduction to the Flutter application updating method, the corresponding Flutter application updating device, the electronic equipment and the computer storage medium provided by the application. The principles and implementation modes of the application are described in this paper. The above examples are only used to help understand the method and its core idea of the application. At the same time, for those skilled in the art, according to the idea of the application, the specific implementation mode and application range will be changed. In summary, the content of the specification should not be understood as a limitation of the application.
Claims
1. A Flutter application updating method, characterized in that, The method comprises: The intermediate bytecode file for updating the Flutter application is pulled by a background service process of a terminal where the Flutter application is located, and the intermediate bytecode file has cross-platform characteristics, and the cross-platform characteristics of the intermediate bytecode file are manifested as corresponding different execution files for different platforms; the server is configured to receive an intermediate bytecode file compiled from a Dart source code file for updating the Flutter application; The intermediate bytecode file with the cross-platform characteristics is compiled by a preset backend compiler of the terminal where the Flutter application is located, to obtain a binary file corresponding to the terminal where the Flutter application is located; The binary file is executed to update the Flutter application.
2. The method of claim 1, wherein, The intermediate bytecode file comprises signature information, and the intermediate bytecode file with the cross-platform characteristics is obtained by the terminal where the Flutter application is located, comprising: The intermediate bytecode file with the cross-platform characteristics is pulled from the server by a background service process of a terminal where the Flutter application is located according to the signature information.
3. The method of claim 1, wherein, The preset backend compiler of the terminal where the Flutter application is located has a platform identifier, and the intermediate bytecode file with the cross-platform characteristics is compiled by the preset backend compiler of the terminal where the Flutter application is located, to obtain a binary file corresponding to the terminal where the Flutter application is located, comprising: The intermediate bytecode file is compiled into a binary file corresponding to the platform identifier by the preset backend compiler, to conform to a platform-specific binary file of the terminal where the Flutter application is located.
4. The method according to claim 1 or 3, characterized in that, Further comprising: The compiled binary file is stored in a backup directory of the Flutter application, and the backup directory is configured to be loaded when an installation directory of the Flutter application is occupied.
5. The method of claim 1, wherein, The binary file is loaded in the installation directory of the Flutter application to start the Flutter application, to update the Flutter application. The binary file is loaded in the installation directory of the Flutter application to start the Flutter application, comprising:
6. The method of claim 5, wherein, The new version of the binary file is obtained from the backup directory of the Flutter application, and the new version of the binary file is overlaid on the old version of the binary file in the installation directory of the Flutter application; When the Flutter application is started, the new version of the binary file in the installation directory is executed to load the updated Flutter application. The device comprises:
7. An updating apparatus of a Flutter application, characterized by comprising: An intermediate bytecode file obtaining module is located in a terminal where a Flutter application is located, and is configured to pull an intermediate bytecode file for updating the Flutter application from a server through a background service process of the terminal where the Flutter application is located in a time manner; the intermediate bytecode file is used to update the Flutter application; the intermediate bytecode file has a cross-platform feature, and the cross-platform feature of the intermediate bytecode file is manifested in that different execution files corresponding to different platforms are provided; the server is configured to receive an intermediate bytecode file obtained by compiling a Dart source code file used to update the Flutter application; An intermediate bytecode file compiling module is located in a backend compiler pre-installed in the terminal where the Flutter application is located, and is configured to compile the intermediate bytecode file having the cross-platform feature by using a use environment of a user to obtain a binary file corresponding to the terminal where the Flutter application is located; An application updating module is configured to execute the binary file to update the Flutter application.
8. An electronic device, comprising: The application further includes a processor, a memory, and a computer program stored on the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the updating method of the Flutter application according to any one of claims 1-6. A computer program is stored on the computer readable storage medium, and when executed by the processor, the computer program implements the steps of the updating method of the Flutter application according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Hot updating method and device, electronic device and readable storage medium
CN110262825A
Method and device for upgrading application program, medium and electronic equipment
CN111338666A
Flutter compiling process intervention method and device
CN113342344A
Business processing method and device, equipment and storage medium
CN116414494A
Systems and methods with integrated gaming engines and smart contracts
US20230173395A1