Dart anomaly statistical method, device and equipment based on Flutter application and storage medium
By setting up a global exception capture function on the client of the Flutter application, catching and counting Dart exceptions, and sending exception information to the server to generate reports, the problem of Dart exceptions not being captured and counted in a timely manner in the Flutter application is solved, and the timely processing and reporting of exceptions are achieved, which improves work efficiency.
Patent Information
- Application Number
- CN202411976545.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
AI Technical Summary
In Flutter applications, Dart exceptions are not captured and counted in time, resulting in data loss, resource leakage, reduced system stability and poor user experience.
By setting a global exception capture function on the client, the Dart exception is captured and related context information is collected, including user ID, device information, current page and operation steps, and sent to the server. The server counts the received exception information and generates an exception report.
It realizes the automation of catching Dart exceptions in Flutter applications online, provides detailed exception reports, helping developers deal with exceptions in a timely manner and improve work efficiency.
Smart Images

Figure CN119988151A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of exception handling technology, and in particular to a Dart exception statistics method, device, equipment and storage medium based on a Flutter application. Background Art
[0002] Dart is a programming language developed by Google and is widely used to build mobile, desktop, backend, and frontend applications, especially with the Flutter framework for creating cross-platform mobile applications. In Dart, exceptions are problems encountered when a program is running, which interrupt the normal program flow. Exceptions are usually caused by errors or unpredictable situations in the program, such as: trying to divide by zero; accessing a non-existent file; trying to use a method or property with a null value; array out-of-bounds access, etc. In Flutter applications, Dart exceptions interrupt the normal program flow. If exceptions are not handled properly, it may cause data loss, resource leakage, system stability degradation, poor user experience and other hazards. Summary of the invention
[0003] The present invention provides a Dart exception statistics method, device, equipment and storage medium based on a Flutter application, so as to realize automatic capture of Dart exceptions and statistics of Dart exceptions when the Flutter application is used online.
[0004] The present invention provides a Dart exception statistics method based on Flutter application, which is applied to a client and includes:
[0005] In response to application startup, a global exception catching function is called;
[0006] When the global exception capture function captures a Dart exception, context information of the application when the Dart exception occurs is collected, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps;
[0007] The Dart exception and the corresponding context information are sent to the server.
[0008] The present invention provides another Dart exception statistics method based on Flutter application, which is applied to the server, including:
[0009] Count the Dart exceptions received from multiple clients and the context information of the application when the Dart exception occurs, wherein the context information includes the user ID, device information, the current page where the Dart exception occurs, and the operation steps;
[0010] Generate an exception report based on the statistical Dart exceptions and the context information.
[0011] According to a Dart exception statistics method based on Flutter application provided by the present invention, the exception report includes: exception type, occurrence frequency, exception impact range, and exception severity.
[0012] A Dart exception statistics method based on a Flutter application provided by the present invention also includes:
[0013] When the statistics of the same type of Dart anomalies reach the preset threshold, an alarm message is sent.
[0014] According to a Dart exception statistics method based on a Flutter application provided by the present invention, when the statistics of the same type of Dart exceptions reach a preset threshold, sending an alarm message includes:
[0015] When the statistics of the same type of Dart exceptions reach a preset threshold, the severity and impact range of the exceptions in the exception report of the same type of Dart exceptions are obtained;
[0016] According to the severity of the abnormality, the impact scope and the preset alarm strategy, the corresponding alarm information is sent.
[0017] A Dart exception statistics method based on a Flutter application provided by the present invention also includes:
[0018] Visualize the statistics and trends of the Dart anomaly.
[0019] The present invention also provides a Dart exception statistics device based on a Flutter application, comprising:
[0020] A calling module, used for calling a global exception catching function in response to application startup;
[0021] A collection module, for collecting context information of the application when the Dart exception occurs when the global exception capture function captures the Dart exception, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps;
[0022] The sending module is used to send the Dart exception and the corresponding context information to the server.
[0023] The present invention also provides another Dart exception statistics device based on a Flutter application, including:
[0024] A statistics module, used to count Dart exceptions sent by multiple clients and context information of the application when the Dart exception occurs, wherein the context information includes user ID, device information, current page where the Dart exception occurs, and operation steps;
[0025] A generation module is used to generate an exception report based on the statistical Dart exceptions and the context information.
[0026] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the Dart anomaly statistics method based on Flutter application as described in any one of the above is implemented.
[0027] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the Dart exception statistics method based on Flutter application as described in any one of the above is implemented.
[0028] The present invention provides a Dart exception statistics method, device, equipment and storage medium based on Flutter application. By setting a global exception capture function on the client, the captured Dart exception and the context information of the application program when the Dart exception occurs are sent to the server in time. The server counts the received Dart exception and context information, and generates an exception report according to the counted Dart exception and context information, so as to realize online capture of Dart exceptions of Flutter application in the use environment. The server provides statistical exceptions and automatically generates exception reports, so that developers can handle and follow up in time and improve work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] Figure 1 This is one of the flow charts of the Dart exception statistics method based on Flutter application provided by the present invention;
[0031] Figure 2 This is the second flow chart of the Dart exception statistics method based on Flutter application provided by the present invention;
[0032] Figure 3This is one of the structural schematic diagrams of the Dart anomaly statistics device based on the Flutter application provided by the present invention;
[0033] Figure 4 This is the second structural schematic diagram of the Dart exception statistics device based on Flutter application provided by the present invention;
[0034] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] It should be noted that, in the description of the embodiments of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "include one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances.
[0037] Combine the following Figures 1 to 5 The present invention describes a Dart exception statistics method, device, equipment and storage medium based on Flutter application.
[0038] like Figure 1 As shown, the present invention provides a Dart exception statistics method based on Flutter application, which can be applied to the client of Flutter application, and specifically may include the following steps:
[0039] Step 110: In response to the application program starting, a global exception catching function is called.
[0040] Specifically, the client is provided with an exception interceptor, and specifically a global exception capture function is set at the entrance of the Flutter application to more comprehensively capture Dart exceptions.
[0041] Step 120: When the global exception capture function captures a Dart exception, context information of the application when the Dart exception occurs is collected, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps.
[0042] Specifically, in addition to capturing Dart exceptions, context information of the application when the exception occurs is also collected so that the server can generate an exception report based on the Dart exception and context information.
[0043] Step 130: Send the Dart exception and the corresponding context information to the server.
[0044] In some embodiments, the client and the server may use encrypted protocols such as HTTPS to transmit exception information.
[0045] Accordingly, if Figure 2 As shown, the present invention provides another Dart exception statistics method based on Flutter application, which can be applied to the server of Flutter application, and specifically may include the following steps:
[0046] Step 210, counting Dart exceptions received from multiple clients and context information of the application when the Dart exception occurs, wherein the context information includes user ID, device information, the current page where the Dart exception occurs, and operation steps.
[0047] Step 220: Generate an exception report based on the counted Dart exceptions and the context information.
[0048] Specifically, the server provides an API interface for receiving exception information, and can store the received exception information in a database, such as using a time series database to store the exception information. The server can deduplicate, classify and perform statistical analysis on the received exception information. In some embodiments, the server can count the exception information through a background task that is executed at a fixed time. An exception report is automatically generated based on the statistical Dart exception and context information.
[0049] The exception report may include: exception type, frequency of occurrence, scope of exception impact, and severity of exception.
[0050] In some embodiments, the method further includes: sending an alarm message when the statistics of Dart anomalies of the same type reach a preset threshold.
[0051] In this embodiment, the server monitors each type of Dart exception in real time. Once the accumulation of Dart exceptions of the same type reaches a predetermined threshold, an alarm is immediately triggered and an alarm message is sent.
[0052] In some embodiments, when the statistics of Dart anomalies of the same type reach a preset threshold, sending an alarm message may specifically include:
[0053] When the statistics of the same type of Dart exceptions reach a preset threshold, the severity and impact range of the exceptions in the exception report of the same type of Dart exceptions are obtained;
[0054] According to the severity of the abnormality, the impact scope and the preset alarm strategy, the corresponding alarm information is sent.
[0055] Specifically, the server can have multiple notification channels, such as email, SMS, instant messaging, etc. The server can set up alert strategies and configure different alert strategies according to the severity of the exception and the scope of impact. For example, if the severity of the exception is high and the scope of impact is large, instant messaging, SMS and email will be sent to ensure that the developer can handle the exception in time; if the severity is low, it can be handled only by email, so that the developer can handle it during working hours. For another example, if the severity of the exception is high and the scope of impact is large, the alert notification range will be wider. The alert strategy can be adjusted and refined according to actual business needs.
[0056] In some embodiments, the method further includes: visually displaying the statistical results and trends of the Dart exceptions. Specifically, the exception management platform on the server side can visualize the statistical results and display the growth trend of Dart exceptions, so that developers can more intuitively understand the prevalence of Dart exceptions in applications.
[0057] In some embodiments, before generating an exception report, the server may desensitize the received exception information to avoid exposing user privacy.
[0058] The above-mentioned Dart exception statistics method based on Flutter application of the present invention sets a global exception capture function on the client, and promptly sends the captured Dart exception and the context information of the application when the Dart exception occurs to the server. The server counts the received Dart exception and context information, and generates an exception report according to the counted Dart exception and context information, so as to realize online capture of Dart exceptions of Flutter application in the use environment. The server provides statistical exceptions and automatically generates exception reports, so that developers can handle and follow up in time and improve work efficiency.
[0059] The Dart exception statistics device based on the Flutter application provided by the present invention is described below. The Dart exception statistics device based on the Flutter application described below and the Dart exception statistics method based on the Flutter application described above can correspond to each other.
[0060] like Figure 3 As shown, the present invention provides a Dart exception statistics device based on Flutter application, including:
[0061] A calling module 310 is used to call a global exception catching function in response to the application starting;
[0062] A collection module 320 is used to collect context information of the application when the Dart exception occurs when the global exception capture function captures the Dart exception, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps;
[0063] The sending module 330 is used to send the Dart exception and the corresponding context information to the server.
[0064] like Figure 4 As shown, the present invention also provides another Dart exception statistics device based on Flutter application, including:
[0065] A statistics module 410 is used to count Dart exceptions sent by multiple clients and context information of the application when the Dart exception occurs, wherein the context information includes user ID, device information, the current page where the Dart exception occurs, and operation steps;
[0066] The generating module 420 is used to generate an exception report according to the statistical Dart exceptions and the context information.
[0067] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the Dart exception statistics method based on the Flutter application, and the method includes:
[0068] In response to application startup, a global exception catching function is called;
[0069] When the global exception capture function captures a Dart exception, context information of the application when the Dart exception occurs is collected, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps;
[0070] Send the Dart exception and the corresponding context information to the server;
[0071] or,
[0072] Count the Dart exceptions received from multiple clients and the context information of the application when the Dart exception occurs, wherein the context information includes the user ID, device information, the current page where the Dart exception occurs, and the operation steps;
[0073] Generate an exception report based on the statistical Dart exceptions and the context information.
[0074] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0075] On the other hand, the present invention further provides a computer program product, the computer program product including a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the Dart anomaly statistics method based on Flutter application provided by the above methods, the method including:
[0076] In response to application startup, a global exception catching function is called;
[0077] When the global exception capture function captures a Dart exception, context information of the application when the Dart exception occurs is collected, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps;
[0078] Send the Dart exception and the corresponding context information to the server;
[0079] or,
[0080] Count the Dart exceptions received from multiple clients and the context information of the application when the Dart exception occurs, wherein the context information includes the user ID, device information, the current page where the Dart exception occurs, and the operation steps;
[0081] Generate an exception report based on the statistical Dart exceptions and the context information.
[0082] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the Dart exception statistics method based on Flutter application provided by the above methods, the method comprising:
[0083] In response to application startup, a global exception catching function is called;
[0084] When the global exception capture function captures a Dart exception, context information of the application when the Dart exception occurs is collected, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps;
[0085] Send the Dart exception and the corresponding context information to the server;
[0086] or,
[0087] Count the Dart exceptions received from multiple clients and the context information of the application when the Dart exception occurs, wherein the context information includes the user ID, device information, the current page where the Dart exception occurs, and the operation steps;
[0088] Generate an exception report based on the statistical Dart exceptions and the context information.
[0089] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0090] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0091] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A Dart exception statistics method based on Flutter application, characterized in that: Applied to the client, including: In response to application startup, a global exception catching function is called; When the global exception capture function captures a Dart exception, context information of the application when the Dart exception occurs is collected, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps; The Dart exception and the corresponding context information are sent to the server.
2. A Dart exception statistics method based on Flutter application, characterized in that: Applied to the server, including: Count the Dart exceptions received from multiple clients and the context information of the application when the Dart exception occurs, wherein the context information includes the user ID, device information, the current page where the Dart exception occurs, and the operation steps; Generate an exception report based on the statistical Dart exceptions and the context information.
3. According to the Dart exception statistics method based on Flutter application according to claim 2, it is characterized in that The abnormality report includes: abnormality type, occurrence frequency, abnormality impact range, and abnormality severity.
4. According to the Dart exception statistics method based on Flutter application according to claim 2, it is characterized in that Also includes: When the statistics of the same type of Dart anomalies reach the preset threshold, an alarm message is sent.
5. According to the Dart exception statistics method based on Flutter application according to claim 4, it is characterized in that: When the statistics of the same type of Dart anomalies reach a preset threshold, an alarm message is sent, including: When the statistics of the same type of Dart exceptions reach a preset threshold, the severity and impact range of the exceptions in the exception report of the same type of Dart exceptions are obtained; According to the severity of the abnormality, the impact scope and the preset alarm strategy, the corresponding alarm information is sent.
6. According to the Dart anomaly statistics method based on Flutter application according to claim 2, it is characterized in that: Also includes: Visualize the statistics and trends of the Dart anomaly.
7. A Dart exception statistics device based on Flutter application, characterized in that: include: A calling module, used for calling a global exception catching function in response to application startup; A collection module, for collecting context information of the application when the Dart exception occurs when the global exception capture function captures the Dart exception, wherein the context information includes a user ID, device information, a current page where the Dart exception occurs, and operation steps; The sending module is used to send the Dart exception and the corresponding context information to the server.
8. A Dart exception statistics device based on Flutter application, characterized in that: include: A statistics module, used to count Dart exceptions sent by multiple clients and context information of the application when the Dart exception occurs, wherein the context information includes user ID, device information, current page where the Dart exception occurs, and operation steps; A generation module is used to generate an exception report based on the statistical Dart exceptions and the context information.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the Dart exception statistics method based on the Flutter application is implemented according to any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the Dart exception statistics method based on the Flutter application is implemented as described in any one of claims 1 to 6.