Application cross-platform data processing method and device, electronic equipment and storage medium
By deleting the current Flutter page in the Flutter page stack and only retaining its engine data, the problem of low cross-platform application performance is solved, and resource saving and performance optimization is achieved.
Patent Information
- Application Number
- CN202411931383.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-18
AI Technical Summary
The performance optimization of cross-platform applications faces challenges, and the performance is relatively low compared to native applications, resulting in poor performance of cross-platform applications in some scenarios.
By deleting the current Flutter page in the Flutter page stack, only retaining its corresponding Flutter engine data, optimizing page stack resource management, reducing resource consumption, and improving performance.
It realizes the reduction of resource consumption of cross-platform applications, optimizes the performance of cross-platform applications, and improves the operation efficiency of applications.
Smart Images

Figure CN119847521A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for cross-platform data processing. Background Art
[0002] At present, there are various operating systems in the mobile application market, such as HarmonyOS, Android, IOS, etc. Each operating system has its own development language and framework. Therefore, developers need to develop mobile applications for different platforms separately, which greatly increases the development cost and time.
[0003] Therefore, cross-platform development of mobile applications has become the choice of developers. However, the performance optimization of cross-platform development faces challenges, and the performance is lower than that of native applications. In some scenarios, cross-platform developed applications do not run well.
[0004] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of the present invention is to provide a cross-platform application data processing method, device, electronic device and storage medium, aiming to solve the above-mentioned problems by reducing the resource consumption of cross-platform applications and optimizing the performance of cross-platform applications.
[0006] To achieve the above object, the present invention provides a method for processing application cross-platform data, the method comprising the following steps:
[0007] In response to a page opening instruction, obtaining a target page to be opened indicated by the page opening instruction;
[0008] Delete the current Flutter page in the Flutter page stack, and retain the Flutter engine data corresponding to the current Flutter page, wherein the current Flutter page is the Flutter page currently saved in the Flutter page stack;
[0009] Open the target page.
[0010] In some optional implementations, deleting the current Flutter page in the Flutter page stack and retaining the Flutter engine data corresponding to the current Flutter page includes:
[0011] When it is determined that the last opened page of the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained, wherein the current Flutter page in the Flutter page stack is the last opened page.
[0012] In some optional implementations, when determining that the last opened page of the target page is a Flutter page, deleting the current Flutter page in the Flutter page stack and retaining the Flutter engine data corresponding to the current Flutter page includes:
[0013] When it is determined that the last opened page of the target page is a Flutter page and the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained.
[0014] In some optional implementations, deleting the current Flutter page in the Flutter page stack and retaining the Flutter engine data corresponding to the current Flutter page includes:
[0015] When it is determined that the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained, wherein the current Flutter page in the Flutter page stack is saved based on the opened Flutter page before the target page is opened.
[0016] In some optional implementations, when the target page is a Flutter page, opening the target page includes:
[0017] Add the route of the target page to the Flutter page stack;
[0018] The target page and Flutter engine data corresponding to the target page are saved in the Flutter page stack, wherein the current Flutter page in the Flutter page stack is updated to the target page.
[0019] In some optional implementations, when the target page is a native page, the step of opening the target page includes:
[0020] Calling the native plug-in corresponding to the native page based on Flutter;
[0021] Create a native page based on the native plug-in and the Flutter engine;
[0022] The native page is displayed.
[0023] In some optional embodiments, the method further comprises:
[0024] In response to the page return instruction, obtaining the currently displayed page;
[0025] If the currently displayed page is a Flutter page, a native page jump instruction is sent to the native platform to return to the native page.
[0026] The present invention also provides a cross-platform data processing device, including.
[0027] An acquisition module, configured to, in response to a page opening instruction, acquire a target page indicated by the page opening instruction to be opened;
[0028] A data deletion module deletes the current Flutter page in the Flutter page stack and retains the Flutter engine data corresponding to the current Flutter page, wherein the current Flutter page is the Flutter page currently saved in the Flutter page stack;
[0029] The page opening module is used to open the target page.
[0030] The present invention also provides an electronic device, comprising: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the various steps of the cross-platform application data processing method as described above when executed by the processor.
[0031] In addition, the present invention also provides a computer-readable storage medium, on which a data processing program is stored. When the data processing program is executed by a processor, each step of the cross-platform application data processing method as described above is implemented.
[0032] An application cross-platform data processing method, device, electronic device and storage medium proposed in an embodiment of the present invention are applied to cross-platform applications and run on different platforms based on Flutter cross-platform technology. When the application performs a page jump operation, such as jumping from a native page to a Flutter page, or from a Flutter page to a native page, the current Flutter page in the Flutter page stack is deleted, and only the Flutter engine data corresponding to the current Flutter page is retained. This can reduce the memory usage of resources and reduce CPU consumption. This embodiment optimizes the page stack resource management to reduce the resource consumption of cross-platform applications and optimize the performance of cross-platform applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic diagram of the terminal structure of the hardware operating environment involved in the embodiment of the present invention;
[0034] Figure 2 A schematic diagram of a flow chart of a first embodiment of a method for processing data across application platforms provided by the present invention;
[0035] Figure 3 A schematic flow chart of a second embodiment of the cross-platform data processing method provided by the invention;
[0036] Figure 4 A schematic flow chart of a third embodiment of the cross-platform data processing method provided by the invention;
[0037] Figure 5 A schematic diagram of the framework of the cross-platform data processing system for the application provided by the invention;
[0038] Figure 6 A schematic diagram of the framework of the native plug-in packaging system provided by the present invention;
[0039] Figure 7 A schematic diagram of the framework of the UI creation system in the Flutter application provided by the present invention.
[0040] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0041] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0042] In order to better understand the technical solutions provided by the embodiments of the present invention, exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0043] As an implementation method, the hardware environment architecture involved in applying the cross-platform data processing method can be as follows: Figure 1 shown.
[0044] Optionally, the hardware architecture involved in applying the cross-platform data processing method includes terminals, such as mobile terminals, computer terminals, etc.
[0045] As an implementation, the terminal includes: a processor 101, such as a CPU, a memory 102, and a communication bus 103. The communication bus 103 is used to implement connection and communication between these components. The processor 101 is used to call an application to perform data processing operations.
[0046] The memory 102 may be a high-speed RAM memory or a non-volatile memory, such as a disk memory.
[0047] It can be understood that, in one embodiment, the data processing program is stored in the memory 102 or in a computer-readable storage medium, and when the processor 101 calls the data processing program from the memory 102 or the computer-readable storage medium, the following operations are performed:
[0048] In response to the page opening instruction, obtaining a target page to be opened indicated by the page opening instruction;
[0049] Delete the current Flutter page in the Flutter page stack and retain the Flutter engine data corresponding to the current Flutter page. The current Flutter page is the Flutter page currently saved in the Flutter page stack.
[0050] Open the target page.
[0051] First embodiment
[0052] Reference Figure 2 An embodiment of the present invention provides a flow chart of a cross-platform data processing method, the method comprising:
[0053] Step S201, in response to a page opening instruction, obtaining a target page indicated by the page opening instruction to be opened;
[0054] This embodiment is applied to a mobile application, and the mobile application can be applied to terminals of different platforms or different systems.
[0055] Optionally, the mobile application in this embodiment encapsulates Android and iOS methods through flutter, so that a set of code can run on multiple operating systems. Using the Dart language, the UI toolkit provided by Geogle improves the reusability of code segments through encapsulation and componentization, reduces repeated development work, avoids unnecessary rendering and operations, achieves high-performance development and maintains a consistent UI style, thereby enhancing the user experience of different users.
[0056] Exemplarily, when a mobile application runs on a terminal and a user opens the mobile application or operates a page jump operation on the mobile application page (such as clicking a link or a button component), a page opening instruction is triggered. The mobile terminal responds to the page opening instruction and determines the corresponding target page to be opened according to the page opening instruction.
[0057] It can be understood that each opening instruction corresponds to an instruction to open a page, and the target page can be determined based on the association between the opening instruction selected by the user and the page.
[0058] S202, delete the current Flutter page in the Flutter page stack, and retain the Flutter engine data corresponding to the current Flutter page;
[0059] Among them, the current Flutter page is the Flutter page currently saved in the Flutter page stack. Optionally, only one Flutter page is saved in the Flutter page stack or no Flutter page is saved. For example, before the target page is opened, no Flutter page has been opened, and no Flutter page is saved in the Flutter page stack. Alternatively, before the target page is opened, a Flutter page has been opened. No matter how many Flutter pages are opened, only the last Flutter page opened is saved. Alternatively, before the target page is opened, a Flutter page has been opened, but the previous page of the target page is a native page, and no Flutter page is saved in the Flutter page stack (each time a page is opened, the previously saved Flutter page will be deleted).
[0060] In this embodiment, the Flutter page is a page implemented using Flutter technology, and the native page is a page that can run directly on the operating system, which is determined by the operating system of the specific application. For example, when the operating system of the application is the Android system, the native page is the Android page. When the operating system is the iOS system, the native page is the iOS page.
[0061] Since the performance of cross-platform applications is lower than that of native applications, an application usually includes native code and Flutter to collaborate to implement various functions of the application. In some implementations, when a Flutter-based application opens a Flutter page, it is necessary to add the route of the Flutter page to the Flutter page stack and save the Flutter page and Flutter engine data in the Flutter page stack. If multiple Flutter pages are opened, a lot of data will be stored in the Flutter page stack, and then when the page rolls back, it rolls back one page at a time from the top of the Flutter page stack. In some usage scenarios, mobile applications occupy too many resources, affecting the stable operation of the system, and thus affecting the performance of cross-platform applications.
[0062] Based on this, this embodiment deletes the current Flutter page in the Flutter page stack every time a page is opened (for example, a page jump), as long as a Flutter page is saved in the Flutter page stack. In the Flutter page stack, only one Flutter page is retained, or no Flutter page is retained, and the Flutter engine data corresponding to the current Flutter page is saved, that is, the previously opened Flutter page is destroyed in time to reduce resource occupation, so that resource saving can be achieved across platforms. Exemplarily, the homepage of the application is opened, and the homepage is a native page. When the user triggers a page opening instruction (page jump instruction) on the homepage, the target page is determined. If the target page is a Flutter page, the Flutter page is saved in the Flutter page stack (at this time, there is no current Flutter page in the Flutter page stack), and the Flutter page is the current Flutter page of the Flutter page stack; when the user triggers the opening instruction on the Flutter page again, the target page is determined. If the target page is a native page, the current Flutter page in the Flutter page stack is destroyed and the native page is displayed; or, if the target page is a Flutter page, the current Flutter page in the Flutter page stack is destroyed, and the new Flutter page is added to the Flutter page stack to become the current Flutter page in the Flutter page stack. The Flutter page in the Flutter page stack is destroyed in a timely manner, and a current Flutter page is always retained.
[0063] Alternatively, in other embodiments, when jumping from a Flutter page (the last opened Flutter page) to a target page, regardless of whether the target page is a native page or a Flutter page, the current Flutter page in the Flutter page stack is destroyed, wherein the current Flutter page in the Flutter page stack is the last opened Flutter page. For the specific implementation process, refer to the detailed description of the second embodiment below.
[0064] Alternatively, in other embodiments, when jumping to a Flutter page (that is, when the target page is a Flutter page), whether jumping from a native page or a Flutter page, the current Flutter page in the Flutter page is destroyed, wherein the current Flutter page in the Flutter page stack may be the last opened page (when the last opened page is a Flutter page), or may be any previously opened Flutter page (when the last opened page is a native page, it is a Flutter page opened before the native page). For details, please refer to the detailed description of the third embodiment below.
[0065] S203, open the target page.
[0066] The implementation method of opening the target page depends on the page type of the target page. For example, for a Flutter page, the route of the target page is added to the Flutter page stack, and for a native page, it is displayed through the native platform or in other ways.
[0067] In this embodiment, when the application responds to the page opening instruction, it deletes the current Flutter page in the Flutter page stack and only retains the Flutter engine data corresponding to the current Flutter page, so that the important data of the Flutter page is saved, and the operation data of the Flutter page is deleted, and the previously opened Flutter page data can be destroyed in time, reducing the memory occupation of the page data, thereby reducing the CPU consumption. Furthermore, when the application is used across platforms, that is, when jumping to the Flutter page, only the current page is saved in the Flutter page stack, so as to reduce the resource consumption of cross-platform applications. This embodiment optimizes the page stack resource management and optimizes the performance of cross-platform applications in the above manner.
[0068] Second embodiment
[0069] Reference Figure 3 Another embodiment of the present invention provides a flow chart of a cross-platform data processing method. This embodiment is based on the above first embodiment. On the basis of the first embodiment, Figure 3 As shown, the method includes:
[0070] S301, in response to a page opening instruction, obtaining a target page to be opened indicated by the page opening instruction;
[0071] Among them, step S301 is the same as step S201 of the above-mentioned first embodiment. Please refer to the above embodiment for details and will not be repeated here.
[0072] S302, determining whether the last opened page of the target page is a Flutter page;
[0073] Before the target page is opened, the previous opened page of the target page refers to the currently opened page. The system records the page type of each page opened. That is, the previous opened page of the target page is the previous opened page after jumping to the target page (also the currently opened page before jumping to the target page).
[0074] If yes, execute S303 to delete the current Flutter page in the Flutter page stack and retain the Flutter engine data corresponding to the current Flutter page;
[0075] When responding to a page opening instruction, if the last opened page is a Flutter page, it means that at least the last opened Flutter page is saved in the Flutter page stack (each time a Flutter page is opened, it is saved in the Flutter page stack as the current Flutter page). And the current Flutter page in the Flutter page stack is the last opened page.
[0076] When the target page is opened, the current Flutter page in the Flutter page stack is deleted, and only the Flutter engine data corresponding to the current Flutter page is retained. In this way, when the target page is opened, it is ensured that there is no current Flutter page in the Flutter page stack, and the target page can be saved in the Flutter page stack (if the target page is also a Flutter page), so that at most one current Flutter page is always saved in the Flutter page stack.
[0077] S304: When it is determined that the target page is a Flutter page, add the route of the Flutter page to the Flutter page stack;
[0078] Among them, the page type of the target page is determined by the system.
[0079] S305, save the target page and the Flutter engine data corresponding to the target page in the Flutter page stack.
[0080] Steps S304 to S305 are examples of jumping from a Flutter page to a Flutter page:
[0081] When the application responds to the page opening instruction and determines that it jumps from the Flutter page to the Flutter page, it first deletes the current Flutter page in the Flutter page stack, then adds the route of the target page to the Flutter page stack to display the target page, and saves the target page and the Flutter engine data corresponding to the target page in the Flutter page stack. Based on this, the current Flutter page in the Flutter page stack is updated to the target page (new Flutter page), that is, the target page is the current page in the Flutter page stack and is deleted again when the next jump occurs.
[0082] S306: When it is determined that the target page is a native page, a native plug-in corresponding to the native page is called based on Flutter;
[0083] S307, creating a native page based on the native plug-in and the Flutter engine;
[0084] S308, displaying the native page.
[0085] Steps S306 to S308 are examples of jumping from the Flutter page to the native page:
[0086] When the application responds to the page opening instruction and determines that it is jumping from the Flutter page to the native page, although the native page does not need to be added to the Flutter page stack, the Flutter page in the Flutter page stack will not be deleted when jumping from the native page to the Flutter page, to avoid the current Flutter page in the Flutter page stack when jumping from the native page to the Flutter page, resulting in the accumulation of Flutter pages when adding new Flutter pages to the Flutter page stack. Therefore, when jumping from the Flutter page to the native page, it can be determined that there must be a current Flutter page in the Flutter page stack, so the Flutter page is deleted to ensure that the Flutter page will not be accumulated in the Flutter page stack when adjusting from the native page.
[0087] In this embodiment, the application is cross-application based on Flutter, in which the native page is encapsulated into a native plug-in. When the native page is displayed, the native plug-in of the native page is called by Flutter, and then the native page is created in the Flutter engine, and then the native page is displayed.
[0088] Optionally, if it is determined whether the last opened page of the target page is a native page, and there is no Flutter page in the Flutter page stack, then the jump operation of the target page can be directly performed, for example, executing steps S304 to 305, or steps S306 to S308.
[0089] For example, assuming that the last opened page is a native page, the operation of jumping from the native page to the target page is performed according to the page type of the target page (native page or Flutter page). In which, each time a Flutter page jumps to a native page or a Flutter page, the current Flutter page in the Flutter page stack is deleted, so when jumping from a native page, there is no current Flutter page in the Flutter page stack.
[0090] Exemplarily, in this embodiment, when the application jumps from the native page to the Flutter page for the first time, the current Flutter page is recorded in the Flutter page stack. When jumping from a Flutter page to another Flutter page, the current Flutter page in the Flutter page stack is deleted, and then the other Flutter page to be jumped to is added to the Flutter page stack. When jumping from the Flutter page to the native page again, the current Flutter page in the Flutter page stack is deleted. At this time, no Flutter page is recorded in the Flutter page stack. If you jump from the native page to the Flutter page again, the new Flutter page is re-recorded in the Flutter page stack, and so on, so that there is only one Flutter page in the Flutter page stack, or no Flutter page.
[0091] In an optional implementation, when the application responds to the page return instruction, the currently displayed page is obtained; if the currently displayed page is a Flutter page, a native page jump instruction is sent to the native platform to return to the native page.
[0092] In this embodiment, if the page jumps to the Flutter page, the return page is triggered from the Flutter page. Since only the current Flutter page is saved in the Flutter page stack, the application directly returns to the native page and sends a page jump instruction to the native platform to call the native plug-in of the native page, generate a native page, and jump to the native page.
[0093] Compared with some technologies, in this embodiment, only the current Flutter page is saved in the Flutter page stack. On the one hand, it can release the resources in the Flutter page stack, and on the other hand, it can quickly return to the native page (such as the home page) to reduce page operations.
[0094] In an optional implementation, when the application responds to a page return instruction, the currently displayed page is obtained; if the currently displayed page is a native page and the returned page is a Flutter page, the Flutter engine data is obtained, the Flutter page is rebuilt, and the Flutter page is displayed to realize the return from the native page to the Flutter page.
[0095] In this embodiment, when the application goes from the Flutter page to the target application, the current Flutter page in the Flutter page stack is deleted, so that when the page jumps, there is only one current Flutter page in the Flutter page stack, thereby achieving the purpose of reducing resource consumption of cross-platform applications.
[0096] Third embodiment
[0097] Reference Figure 4 Another embodiment of the present invention provides a flow chart of a cross-platform data processing method. This embodiment is based on all the above embodiments. Figure 3 As shown, the method includes:
[0098] S401, in response to a page opening instruction, obtaining a target page to be opened indicated by the page opening instruction;
[0099] Among them, step S401 is the same as step S201 of the above-mentioned first embodiment. Please refer to the above embodiment for details and will not be repeated here.
[0100] S402: When it is determined that the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained;
[0101] Among them, the page type of the target page is determined based on the system.
[0102] S403: Save the target page and the Flutter engine data corresponding to the target page in the Flutter page stack.
[0103] S404: When it is determined that the target page is a native page, a native plug-in corresponding to the native page is called based on Flutter;
[0104] S405, creating a native page based on the native plug-in and the Flutter engine;
[0105] S406, displaying the native page.
[0106] This embodiment is similar to the second embodiment, except that in this embodiment, when a page jumps from a native page or a Flutter page to a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained. When a page jumps from a native page or a Flutter page to a native page, the native page is displayed, and the current Flutter page in the Flutter page stack is not deleted.
[0107] For example: the home page of the application is opened, and the home page is a native page. When the user triggers the page opening instruction from the home page, the page opening instruction is responded to and the target page is determined to be a Flutter page. At this time, there is no Flutter page recorded in the Flutter page stack, so there is no need to delete the current Flutter page in the Flutter page stack. The route of the Flutter page is added to the Flutter page stack, and the current Flutter page and the Flutter engine data corresponding to the Flutter page are recorded in the Flutter page stack. When the user triggers the page opening instruction based on the Flutter page and determines that the target page is a Flutter page, in order to avoid the accumulation of Flutter pages in the Flutter page stack, the current Flutter page in the Flutter page is destroyed, and then the route of the new Flutter page is added to the Flutter page stack, and the Flutter page is recorded as the current Flutter page. When the user triggers the page opening instruction based on the Flutter page and determines that the target page is a native page, the native plug-in is called, a native page is created, and the native page is displayed on the terminal. At this time, the Flutter page stack records the Flutter page before the native page. At this time, if the user triggers a page opening instruction based on the native page, and the target page corresponding to the page opening instruction is a Flutter page, at this time, in order to avoid the accumulation of Flutter page stack when the new Flutter page is added to the Flutter page stack, the current Flutter page in the original Flutter page stack is destroyed, and then the new Flutter page is added to the Flutter page stack.
[0108] That is, in this embodiment, when jumping to the Flutter page, the historically saved Flutter page in the Flutter page stack can be deleted, and then a new Flutter page can be added to the Flutter page, so that only the current Flutter page is saved in the Flutter page stack.
[0109] In an optional implementation, when the application responds to the page return instruction, the currently displayed page is obtained; if the currently displayed page is a Flutter page, a native page jump instruction is sent to the native platform to return to the native page.
[0110] In this embodiment, if the page jumps to the Flutter page, the return page is triggered from the Flutter page. Since only the current Flutter page is saved in the Flutter page stack, the application directly returns to the native page and sends a page jump instruction to the native platform to call the native plug-in of the native page, generate a native page, and jump to the native page.
[0111] Compared with some technologies, in this embodiment, only the current Flutter page is saved in the Flutter page stack. On the one hand, it can release the resources in the Flutter page stack, and on the other hand, it can quickly return to the native page (such as the home page) to reduce page operations.
[0112] In an optional implementation, when the application responds to a page return instruction, the currently displayed page is obtained; if the currently displayed page is a native page, and the returned page is a Flutter page, and the Flutter page has not been deleted in the Flutter page engine, then jump to the current Flutter page in the Flutter page engine.
[0113] In this embodiment, when the application is used across platforms, that is, when jumping to the Flutter page, only the current page is saved in the Flutter page stack, thereby reducing the resource consumption of cross-platform applications. This embodiment optimizes page stack resource management and optimizes the performance of cross-platform applications in the above manner. When the application is not used across platforms, data can also be updated in a timely manner.
[0114] like Figure 5 As shown, an embodiment of the present application also provides an application cross-platform data processing system, including a Flutter engine layer, which is used for rendering and event processing.
[0115] Dart framework layer: The Dart framework layer provides an API interface to communicate with the native platform.
[0116] Application layer: The application layer implements business logic.
[0117] The native code layer is the specific function encapsulated by Flutter.
[0118] In this embodiment, the native page is called by Flutter through a native plug-in, and the native page is created in Flutter.
[0119] For example, Figure 6 As shown in the figure, the corresponding native code will be created on the native platform; then, through the native encapsulation layer, the native code will be encapsulated into a native plug-in that can be called by Flutter according to the requirements; references and interfaces to the native code will be added to the Flutter engine layer, and finally, the native plug-in will be registered in the Flutter application layer so that the Flutter code can call the native plug-in.
[0120] For example, Figure 7 As shown, the Flutter code calls the native code plug-in to read the Flutter engine layer (Flutter Engine layer) data, and builds the application UI interface according to the native code plug-in and the Flutter engine layer data, which can adapt to the display requirements of different platforms.
[0121] In this embodiment, jumping from a native page to a flutter page, or from a flutter page to a native page, is done through Get. When jumping to a native page, the native code is called to create a native UI. When jumping from a native page to a flutter page, the Engine data is read again to create a flutter UI.
[0122] In this embodiment, the engine layer, Dart framework layer, application layer, and native code layer of Flutter jointly achieve high-performance, high-fidelity cross-platform application development through close collaboration and communication mechanisms.
[0123] The present invention also provides a cross-platform data processing device, including.
[0124] An acquisition module, configured to respond to a page opening instruction and acquire a target page indicated by the page opening instruction to be opened;
[0125] The data deletion module deletes the current Flutter page in the Flutter page stack and retains the Flutter engine data corresponding to the current Flutter page. The current Flutter page is the Flutter page currently saved in the Flutter page stack.
[0126] The page opening module is used to open the target page.
[0127] The cross-platform application data processing device provided in the embodiment of the present invention can execute the steps involved in the terminal in the above-mentioned corresponding method embodiment. Its implementation principle and technical effects are similar and will not be repeated here.
[0128] The present invention also provides an electronic device, comprising: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program implements the above-mentioned steps of the cross-platform data processing method when executed by the processor.
[0129] In addition, the present invention also provides a computer-readable storage medium, on which a data processing program is stored. When the data processing program is executed by a processor, each step of the above-mentioned cross-platform application data processing method is implemented.
[0130] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as above, and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of various embodiments of the present invention.
[0131] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A cross-platform data processing method, characterized in that: include: In response to a page opening instruction, obtaining a target page to be opened indicated by the page opening instruction; Delete the current Flutter page in the Flutter page stack, and retain the Flutter engine data corresponding to the current Flutter page, wherein the current Flutter page is the Flutter page currently saved in the Flutter page stack; Open the target page.
2. The method according to claim 1, characterized in that The deleting the current Flutter page in the Flutter page stack and retaining the Flutter engine data corresponding to the current Flutter page includes: When it is determined that the last opened page of the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained, wherein the current Flutter page in the Flutter page stack is the last opened page.
3. The method according to claim 2, characterized in that When it is determined that the last opened page of the target page is a Flutter page, the step of deleting the current Flutter page in the Flutter page stack and retaining the Flutter engine data corresponding to the current Flutter page includes: When it is determined that the last opened page of the target page is a Flutter page and the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained.
4. The method according to claim 1, characterized in that The deleting the current Flutter page in the Flutter page stack and retaining the Flutter engine data corresponding to the current Flutter page includes: When it is determined that the target page is a Flutter page, the current Flutter page in the Flutter page stack is deleted, and the Flutter engine data corresponding to the current Flutter page is retained, wherein the current Flutter page in the Flutter page stack is saved based on the opened Flutter page before the target page is opened.
5. The method according to any one of claims 1 to 3, characterized in that When the target page is a Flutter page, opening the target page includes: Add the route of the target page to the Flutter page stack; The target page and Flutter engine data corresponding to the target page are saved in the Flutter page stack, wherein the current Flutter page in the Flutter page stack is updated to the target page.
6. The method according to any one of claims 1 or 2, characterized in that: When the target page is a native page, the step of opening the target page includes: Calling the native plug-in corresponding to the native page based on Flutter; Create a native page based on the native plug-in and the Flutter engine; The native page is displayed.
7. The method according to claim 1, characterized in that The method further comprises: In response to the page return instruction, obtaining the currently displayed page; If the currently displayed page is a Flutter page, a native page jump instruction is sent to the native platform to return to the native page.
8. An application cross-platform data processing device, characterized in that: include. An acquisition module, configured to, in response to a page opening instruction, acquire a target page indicated by the page opening instruction to be opened; A data deletion module deletes the current Flutter page in the Flutter page stack and retains the Flutter engine data corresponding to the current Flutter page, wherein the current Flutter page is the Flutter page currently saved in the Flutter page stack; The page opening module is used to open the target page.
9. An application cross-platform data processing device, characterized in that: The device comprises: a memory, a processor, and a data processing program stored in the memory and executable on the processor. When the data processing program is executed by the processor, the steps of the cross-platform application data processing method as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data processing program, and when the data processing program is executed by a processor, the steps of the cross-platform application data processing method according to any one of claims 1 to 7 are implemented.