Flutter navigation method, device and system based on strong type routing

By scanning the source code files of a Flutter project to generate strongly typed router implementation information, the lack of type safety and the problem of scattered route configuration in existing technologies are solved. This enables type-safe route parameter passing and navigation processes, improving navigation reliability and development efficiency.

CN122437801APending Publication Date: 2026-07-21SHENZHEN GREEN CONNECTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN GREEN CONNECTION TECH CO LTD
Filing Date
2026-03-11
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing Flutter application development, the routing navigation mechanism suffers from a lack of type safety and a fragmented routing configuration, resulting in missing compile-time type checks, high code complexity, frequent path spelling errors, low development efficiency, and the need to write a large amount of redundant boilerplate code.

Method used

A navigation method based on strongly typed routing is adopted. By scanning the source code files of the Flutter project, router implementation information is generated, including the route configuration table, link processing logic and navigation methods, to achieve type-safe route parameter passing and navigation process.

Benefits of technology

It improves the reliability, accuracy, and stability of navigation in Flutter projects, reduces the development complexity of route navigation, increases development efficiency, and reduces type errors and code maintenance difficulty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122437801A_ABST
    Figure CN122437801A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of route navigation, and discloses a Flutter navigation method, device and system based on strong-type routing, which comprises the following steps: determining router implementation information of a Flutter project according to target page component units and routing configuration parameters of the scanned Flutter project, and generating a routing instance of the Flutter project according to the router implementation information, so as to call a target navigation method in the routing instance according to a received routing instance calling instruction of the Flutter project, and complete the navigation process of a target page of the Flutter project. It can be seen that the application can realize the intelligent navigation process of the target page, effectively improve the navigation reliability, accuracy and stability of the Flutter project, improve the quality of the Flutter project route navigation, reduce the development complexity of the route navigation technology, and improve the development efficiency of the Flutter project route navigation technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of routing and navigation technology, and in particular to a Flutter navigation method, apparatus and system based on strongly typed routing. Background Technology

[0002] In existing Flutter application development practices, the routing navigation mechanism commonly uses the Navigator and MaterialApp components provided by Flutter. This mechanism relies on string path matching and manual route configuration to achieve page navigation. However, this traditional approach exposes significant technical limitations in several key technical dimensions. Specifically, regarding type safety, because route parameters and return values ​​are defined as broad types, compile-time type checking is lacking. This necessitates frequent manual type conversions and null checks during development, which not only increases code complexity and introduces runtime errors but also makes it difficult to detect parameter type mismatches during the compilation phase. Furthermore, in terms of code maintenance, the dispersed nature of route configurations makes unified management extremely difficult. Manually maintained route mapping tables are not only inefficient but also prone to path spelling errors. Moreover, passing route parameters requires writing a large amount of repetitive and redundant boilerplate code, severely impacting development efficiency and code quality. Therefore, proposing a technical solution that can improve the efficiency and quality of Flutter routing navigation is crucial. Summary of the Invention

[0003] This invention provides a Flutter navigation method, device, and system based on strongly typed routing, which effectively improves the reliability, accuracy, and stability of navigation in Flutter projects and enhances the quality of routing navigation in Flutter projects. At the same time, it also reduces the development complexity of routing navigation technology and improves the development efficiency of routing navigation technology in Flutter projects.

[0004] To address the aforementioned technical problems, the first aspect of this invention discloses a Flutter navigation method based on strongly typed routing. The method is applied to a terminal device with a Flutter project installed, and the terminal device is capable of communicating with a network-attached storage device. The method includes: Based on preset file extension scanning requirements parameters, the source code files of the Flutter project are scanned to obtain the target page component units and routing configuration parameters of the Flutter project; Based on the target page component unit and the routing configuration parameters, the router implementation information of the Flutter project is determined, and a routing instance of the Flutter project is generated based on the router implementation information; the router implementation information includes at least a routing configuration table, link processing logic information, and navigation method implementation information; The system receives a route instance invocation instruction from the Flutter project, and invokes the target navigation method in the route instance according to the route instance invocation instruction to obtain the invocation result of the target navigation method, thereby completing the navigation process of the target page of the Flutter project.

[0005] As an optional implementation, in the first aspect of the present invention, determining the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters includes: Static analysis is performed on the target page component unit to obtain the static analysis results of the target page component unit; the static analysis results include at least one of class structure analysis results, constructor analysis results, annotation identification results, and parameter type analysis results, and the class structure analysis results include component unit class inheritance relationship information and / or component unit class visibility information; Based on the static analysis results and the routing configuration parameters, a page routing information class for the target page component unit is generated; the page routing information class includes at least one of a route name class, a route path class, a constructor parameter attribute class, and a navigation method class; Based on the page routing information class, determine the router implementation information of the Flutter project.

[0006] As an optional implementation, in the first aspect of the present invention, the routing instance invocation instruction of the Flutter project includes at least one of the following: a route push method invocation instruction, a route replacement method invocation instruction, and a route smart navigation method invocation instruction; The step of invoking the target navigation method in the route instance according to the route instance invocation instruction, and obtaining the invocation result of the target navigation method, includes: According to the route instance invocation instruction, the target route information in the route instance invocation instruction is obtained, and the target route configuration information is matched from the route configuration table corresponding to the route instance according to the target route information; the target route information includes target route name information and / or target route path information, and the target route configuration information includes at least one of page component unit type configuration information, path mode configuration information, and sub-route configuration information; Perform a type conversion operation on the target parameters in the target route configuration information to obtain converted parameters, and verify the converted parameters to obtain the verification result of the converted parameters; When the verification result indicates that the converted parameters are normal, the target parameters and the converted parameters are injected into the target page component unit of the Flutter project; After injection is complete, the page style parameters of the Flutter project are determined according to the target route configuration information, and the path object of the Flutter project is created according to the page style parameters; After creation, based on the target route information, the target navigation method in the route instance is called to update the route stack in the Flutter project; The project observation information of the Flutter project is obtained through a preset route observer, and the call result of the target navigation method is determined based on the project observation information; the project observation information includes at least one of the following: event tracking statistics, log records, and performance information.

[0007] As an optional implementation, in the first aspect of the present invention, the router implementation information further includes route guard implementation information; The method further includes, after matching the target route configuration information from the route configuration table corresponding to the route instance based on the target route information: Based on the route guard implementation information and the target route configuration information, create the route guard chain of the Flutter project; By using the route guard chain, the navigation execution method that matches the target route configuration information is invoked, and the invocation result of the navigation execution method is obtained; When the navigation execution method call result indicates that navigation is allowed, the operation of converting the target parameters in the target route configuration information to obtain the converted parameters is triggered.

[0008] As an optional implementation, in the first aspect of the present invention, the link processing logic information includes deep link processing logic information; Furthermore, the method further includes: Receive the deep link of the Flutter project, and perform a target transformation operation on the deep link to obtain the transformed link; the target transformation operation includes at least one of prefix stripping operation, path rewriting operation, and parameter transformation operation; The converted link is subjected to a target verification operation to obtain the verification result of the converted link; the target verification operation includes at least one of path whitelist check operation, permission check operation, and parameter validity verification operation; When the verification result of the converted link indicates that the converted link is normal, the link route configuration information of the converted link is matched from the route configuration table according to the converted link, and the path parameters and query parameters in the link route configuration information are extracted. Based on the path parameters and the query parameters, the navigation type of the Flutter project is determined, and a target navigation operation is performed on the Flutter project according to the navigation type; the navigation type includes nested navigation type or tab navigation type.

[0009] As an optional implementation, in a first aspect of the invention, performing a target navigation operation on the Flutter project according to the navigation type includes: When the navigation type includes the nested navigation type, the parent route and child route of the Flutter project are constructed according to the link route configuration information to obtain the nested router of the Flutter project; The nested router is rendered to obtain a rendered nested router, and a parent route navigation operation or a child route navigation operation is performed on the Flutter project through the router instance corresponding to the rendered nested router. The rendered nested router includes a rendered parent route and a rendered child route, and the constructor parameters of the rendered child route are inherited from the path parameters of the rendered parent route.

[0010] As an optional implementation, in a first aspect of the invention, performing a target navigation operation on the Flutter project according to the navigation type includes: When the navigation type includes the Tab navigation type, the parent route and Tab route of the Flutter project are constructed according to the link route configuration information; An automatic tab route instance is created in the parent page of the parent route, and the active tabs in the Flutter project are switched using the automatic tab route instance and preset transition animation configuration parameters to perform tab navigation operations on the Flutter project.

[0011] A second aspect of the present invention discloses a Flutter navigation device based on strongly typed routing, the device being applied to a terminal device with a Flutter project installed, and the terminal device being capable of communicating with a network-attached storage device, the device comprising: The scanning module is used to scan the source code files of the Flutter project according to preset file extension scanning requirements parameters to obtain the target page component units and routing configuration parameters of the Flutter project. The determination module is used to determine the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters; The generation module is used to generate a route instance of the Flutter project based on the router implementation information; the router implementation information includes at least a route configuration table, link processing logic information, and navigation method implementation information. The receiving module is used to receive the routing instance invocation instructions of the Flutter project; The navigation module is used to call the target navigation method in the route instance according to the route instance call instruction, and obtain the call result of the target navigation method to complete the navigation process of the target page of the Flutter project.

[0012] As an optional implementation, in the second aspect of the present invention, the method by which the determining module determines the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters specifically includes: Static analysis is performed on the target page component unit to obtain the static analysis results of the target page component unit; the static analysis results include at least one of class structure analysis results, constructor analysis results, annotation identification results, and parameter type analysis results, and the class structure analysis results include component unit class inheritance relationship information and / or component unit class visibility information; Based on the static analysis results and the routing configuration parameters, a page routing information class for the target page component unit is generated; the page routing information class includes at least one of a route name class, a route path class, a constructor parameter attribute class, and a navigation method class; Based on the page routing information class, determine the router implementation information of the Flutter project.

[0013] As an optional implementation, in the second aspect of the present invention, the routing instance invocation instruction of the Flutter project includes at least one of the following: a route push method invocation instruction, a route replacement method invocation instruction, and a route smart navigation method invocation instruction; Specifically, the method by which the calling module invokes the target navigation method in the route instance according to the route instance invocation instruction, and obtains the invocation result of the target navigation method, includes: According to the route instance invocation instruction, the target route information in the route instance invocation instruction is obtained, and the target route configuration information is matched from the route configuration table corresponding to the route instance according to the target route information; the target route information includes target route name information and / or target route path information, and the target route configuration information includes at least one of page component unit type configuration information, path mode configuration information, and sub-route configuration information; Perform a type conversion operation on the target parameters in the target route configuration information to obtain converted parameters, and verify the converted parameters to obtain the verification result of the converted parameters; When the verification result indicates that the converted parameters are normal, the target parameters and the converted parameters are injected into the target page component unit of the Flutter project; After injection is complete, the page style parameters of the Flutter project are determined according to the target route configuration information, and the path object of the Flutter project is created according to the page style parameters; After creation, based on the target route information, the target navigation method in the route instance is called to update the route stack in the Flutter project; The project observation information of the Flutter project is obtained through a preset route observer, and the call result of the target navigation method is determined based on the project observation information; the project observation information includes at least one of the following: event tracking statistics, log records, and performance information.

[0014] As an optional implementation, in a second aspect of the present invention, the router implementation information further includes route guard implementation information; The calling module is further configured to: After matching the target route configuration information from the route configuration table corresponding to the route instance based on the target route information, the route guard chain of the Flutter project is created based on the route guard implementation information and the target route configuration information; By using the route guard chain, the navigation execution method that matches the target route configuration information is invoked, and the invocation result of the navigation execution method is obtained; When the navigation execution method call result indicates that navigation is allowed, the operation of converting the target parameters in the target route configuration information to obtain the converted parameters is triggered.

[0015] As an optional implementation, in a second aspect of the present invention, the link processing logic information includes deep link processing logic information; Furthermore, the receiving module is also used for: Receive the deep link of the Flutter project; The device further includes: A conversion module is used to perform a target conversion operation on the deep link to obtain a converted link; the target conversion operation includes at least one of prefix stripping, path rewriting, and parameter conversion. The verification module is used to perform target verification operations on the converted link and obtain the verification result of the converted link; the target verification operation includes at least one of path whitelist check operation, permission check operation, and parameter validity verification operation; The matching module is used to match the link routing configuration information of the converted link from the routing configuration table when the verification result of the converted link indicates that the converted link is normal. The extraction module is used to extract path parameters and query parameters from the link routing configuration information; The determining module is further configured to determine the navigation type of the Flutter project based on the path parameters and the query parameters; The navigation module is further configured to perform target navigation operations on the Flutter project according to the navigation type; the navigation type includes nested navigation type or tab navigation type.

[0016] As an optional implementation, in a second aspect of the present invention, the navigation module performs a target navigation operation on the Flutter project according to the navigation type, specifically including: When the navigation type includes the nested navigation type, the parent route and child route of the Flutter project are constructed according to the link route configuration information to obtain the nested router of the Flutter project; The nested router is rendered to obtain a rendered nested router, and a parent route navigation operation or a child route navigation operation is performed on the Flutter project through the router instance corresponding to the rendered nested router. The rendered nested router includes a rendered parent route and a rendered child route, and the constructor parameters of the rendered child route are inherited from the path parameters of the rendered parent route.

[0017] As an optional implementation, in a second aspect of the present invention, the navigation module performs a target navigation operation on the Flutter project according to the navigation type, specifically including: When the navigation type includes the Tab navigation type, the parent route and Tab route of the Flutter project are constructed according to the link route configuration information; An automatic tab route instance is created in the parent page of the parent route, and the active tabs in the Flutter project are switched using the automatic tab route instance and preset transition animation configuration parameters to perform tab navigation operations on the Flutter project.

[0018] A third aspect of the present invention discloses a terminal device, the terminal device comprising: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the Flutter navigation method based on strongly typed routing disclosed in the first aspect of the present invention.

[0019] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute the Flutter navigation method based on strongly typed routing disclosed in the first aspect of the present invention.

[0020] The fifth aspect of the present invention discloses a Flutter navigation system based on strongly typed routing, the system comprising the Flutter navigation device based on strongly typed routing disclosed in the second aspect of the present invention, and a network-attached storage device communicatively connected to the device; or, the system comprises a terminal device disclosed in the third aspect of the present invention, and a network-attached storage device communicatively connected to the terminal device.

[0021] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: In this embodiment of the invention, the router implementation information of the Flutter project is determined based on the scanned target page component units and routing configuration parameters. A routing instance of the Flutter project is then generated based on this router implementation information. Subsequently, according to the received routing instance invocation command, the target navigation method within the routing instance is invoked to complete the navigation process of the target page of the Flutter project. Therefore, implementing this invention enables intelligent navigation of the target page, effectively improving the reliability, accuracy, and stability of Flutter project navigation, and enhancing the quality of Flutter project routing navigation. Simultaneously, it reduces the development complexity of routing navigation technology and improves the development efficiency of Flutter project routing navigation technology. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart illustrating a Flutter navigation method based on strongly typed routing disclosed in an embodiment of the present invention. Figure 2 This is a flowchart illustrating another Flutter navigation method based on strongly typed routing disclosed in an embodiment of the present invention. Figure 3 This is a schematic diagram of the structure of a Flutter navigation device based on strongly typed routing disclosed in an embodiment of the present invention; Figure 4 This is a schematic diagram of another Flutter navigation device based on strongly typed routing disclosed in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of a terminal device disclosed in an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of a Flutter navigation system based on strongly typed routing disclosed in an embodiment of the present invention. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.

[0026] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0027] This invention discloses a Flutter navigation method, device, and system based on strongly typed routing, which effectively improves the reliability, accuracy, and stability of navigation in Flutter projects and enhances the quality of routing navigation in Flutter projects. At the same time, it also reduces the development complexity of routing navigation technology and improves the development efficiency of routing navigation technology in Flutter projects.

[0028] Example 1 Please see Figure 1 , Figure 1 This is a flowchart illustrating a Flutter navigation method based on strongly typed routing disclosed in an embodiment of the present invention. Optionally, this method can be implemented by a Flutter navigation device, which can be integrated into a terminal device (such as a smart computer, smart tablet, or smartphone), or it can be a local server or cloud server used to process the Flutter navigation process based on strongly typed routing, etc. The embodiments of the present invention do not impose limitations. Furthermore, this method can be applied to terminal devices with a Flutter project installed, and the terminal device can communicate with a network-attached storage device. Wherein, such as Figure 1 As shown, this Flutter navigation method based on strongly typed routes can include the following operations: 101. Based on the preset file extension scanning requirements, scan the source code files of the Flutter project to obtain the target page component units and route configuration parameters of the Flutter project.

[0029] In this embodiment of the invention, for example, after the code generator starts, it first needs to scan the source code files of the Flutter project. The scanning process can employ a recursive traversal to access all Dart source code files in the project. For each file, the generator examines the file content and searches for specific annotation markers. Specific operations may include: File traversal mechanism: Starting from the root directory of the Flutter project, recursively traverse all subdirectories to identify all source code files with the .dart extension; Annotation recognition mechanism: Perform syntax parsing on each file, look for class definitions marked with the @RoutePage annotation, these classes are usually page widgets (specifically referring to the smallest reusable component unit that constitutes the application interface); at the same time, look for class definitions marked with the @AutoRouterConfig annotation, these classes are router configuration classes.

[0030] In addition, a file filtering mechanism can be set up, that is, the generator can be configured to only process files in specific directories, such as only processing files in the lib / ui / directory, or only processing files whose filenames end with _screen.dart, in order to improve generation efficiency.

[0031] 102. Based on the target page component units and routing configuration parameters, determine the router implementation information of the Flutter project, and generate a routing instance for the Flutter project based on the router implementation information.

[0032] In this embodiment of the invention, the router implementation information further includes at least a routing configuration table, link processing logic information, and navigation method implementation information; additionally, the router implementation information may also include route guard implementation information. The link processing logic information includes deep link processing logic information.

[0033] 103. Receive the route instance call instruction of the Flutter project, and call the target navigation method in the route instance according to the route instance call instruction to obtain the call result of the target navigation method, so as to complete the navigation process of the target page of the Flutter project.

[0034] In this embodiment of the invention, optionally, the route instance invocation instruction of the Flutter project includes at least one of the route push method invocation instruction, the route replacement method invocation instruction, and the route smart navigation method invocation instruction.

[0035] As can be seen, implementing the embodiments of the present invention can realize the intelligent navigation process of the target page, effectively improve the navigation reliability, accuracy and stability of Flutter projects, and improve the quality of Flutter project routing navigation; at the same time, it also reduces the development complexity of routing navigation technology and improves the development efficiency of Flutter project routing navigation technology.

[0036] In an optional embodiment, the router implementation information of the Flutter project is determined based on the target page component unit and routing configuration parameters, including: Perform static analysis on the target page component units to obtain the static analysis results of the target page component units; Based on the static analysis results and routing configuration parameters, generate the page routing information class for the target page component unit; Based on the page routing information class, determine the router implementation information of the Flutter project.

[0037] In this optional embodiment, the static analysis results may optionally include at least one of class structure analysis results, constructor analysis results, annotation identification results, and parameter type analysis results; and the class structure analysis results may include component unit class inheritance relationship information and / or component unit class visibility information. Further optionally, the page routing information class may include at least one of a route name class, a route path class, a constructor parameter attribute class, and a navigation method class.

[0038] For example, for each page widget (i.e., target page component unit) found with the @RoutePage annotation, the generator needs to perform a detailed static analysis, which may include: Class structure analysis: Identify the inheritance relationship of the Widget class to confirm that it is a valid Flutter Widget; analyze the visibility modifiers of the class to ensure that the generated code can access them correctly. Constructor analysis: Extract the complete signature of the constructor, including the type, name, required status, and default value of all parameters; and identify whether the constructor's parameters are positional or named parameters. Annotation recognition: Recognizes the @PathParam annotation on constructor parameters, which will be extracted from the URI path; recognizes the @QueryParam annotation, which will be extracted from the URI query string; recognizes the @PathParam.inherit annotation, which will be inherited from the parent route. Type inference: Analyze the type of each parameter to determine whether it is a basic type (int, double, bool, String) or a user-defined type; for user-defined types, it is necessary to check whether there are serialization / deserialization methods.

[0039] Furthermore, based on the static analysis results, the generator generates a corresponding PageRouteInfo class for each page widget. The generation process includes: Route name generation: Generate route name constants based on the class name of the page widget. For example, generate BookListRoute based on BookListPage. The route name follows the naming convention. You can configure custom replacement rules through replaceInRouteName. Route path generation: If a path is specified in the route configuration, the specified path will be used; otherwise, the path can be automatically generated based on the route name, for example, the path / book-list can be generated based on BookListRoute; Parameter property generation: Generates corresponding properties for each constructor parameter, with the property type matching the parameter type; generates getter methods for the parameters, which can be used to access the parameter values; Navigation method generation: Generate a push method to push a route onto the navigation stack; generate a replace method to replace the current route; generate a navigate method to navigate to a specified route (jump if the route already exists, otherwise push it onto the stack), etc.

[0040] Finally, the generator produces complete implementation code for the page routing information class. The generation process includes: Route matching table generation: Generates a route matching table that maps route names and paths to corresponding route configurations. This matching table supports fast lookups and can use a hash table or dictionary structure. Route guard chain generation: Analyze the guard list in the route configuration to generate guard chain execution logic; the guard chains are executed in the configuration order, supporting global guards and route-level guards; Deep link processing logic generation: Generate URI parsing logic, supporting standard URI format; generate path matching logic, supporting prefix matching and wildcard matching; generate route stack construction logic, supporting linear route stacks and nested route stacks; Navigation method implementation generation: Generate the implementation of the push method, including the complete process of route matching, guard checks, parameter extraction, page construction, and navigation execution; generate the implementation of the pop method, including logic such as route stack updates and result return.

[0041] As can be seen, this optional embodiment can perform static analysis on the target page component unit and generate the page routing information class of the target page component unit based on the static analysis results and routing configuration parameters, thereby determining the router implementation information of the Flutter project. This improves the reliability and accuracy of generating the page routing information class of the target page component unit, and consequently improves the reliability, accuracy, and efficiency of determining the router implementation information of the Flutter project, thus facilitating the accurate and efficient generation of routing instances in the Flutter project.

[0042] In another optional embodiment, according to the route instance invocation instruction, the target navigation method in the route instance is invoked, and the invocation result of the target navigation method is obtained, including: Based on the routing instance invocation command, obtain the target route information in the routing instance invocation command, and based on the target route information, match the target route configuration information from the routing configuration table corresponding to the routing instance; Perform a type conversion operation on the target parameters in the target route configuration information to obtain the converted parameters, and verify the converted parameters to obtain the verification results of the converted parameters; When the verification result indicates that the converted parameters are normal, the target parameters and the converted parameters are injected into the target page component unit of the Flutter project; After injection is complete, the page style parameters of the Flutter project are determined based on the target route configuration information, and the path object of the Flutter project is created based on the page style parameters; After creation, the target navigation method in the route instance is called based on the target route information to update the route stack in the Flutter project; By using pre-defined route observers, project observation information of the Flutter project is obtained, and the call result of the target navigation method is determined based on the project observation information.

[0043] In this optional embodiment, the target route information may optionally include target route name information and / or target route path information; and the target route configuration information may optionally include at least one of page component unit type configuration information, path mode configuration information, and sub-route configuration information. Further optionally, the project observation information may include at least one of event tracking statistics, log records, and performance information.

[0044] For example, when a user invokes a target navigation method through a route instance, a strongly typed PageRouteInfo object is passed in. The invocation process includes: Method selection: Choose the appropriate method based on navigation requirements. Push is used to push in a new route, replace is used to replace the current route, and navigate is used for smart navigation (jump if it exists, push if it does not exist). Parameter passing: The PageRouteInfo object contains all the information about the target route, including the route name, path, parameter values ​​(the parameter values ​​have been type-checked to ensure type safety), etc. Context retrieval: If called through the context.router extension method, the system will automatically retrieve the current routing context; if called directly through the router instance, the global router instance will be used.

[0045] The system searches for the corresponding route configuration in the route configuration table based on the route name or path in PageRouteInfo. The matching process includes: Name matching: First, attempt an exact match based on the route name, which is the fastest matching method; if a matching route configuration is found, use that configuration directly. Path matching: If name matching fails, try matching based on the path; path matching supports exact matching and prefix matching; for dynamic path segments (such as :id), pattern matching is required; Matching result processing: If the match is successful, obtain the route configuration object, which includes information such as page Widget type, path mode, sub-routes, and guards; if the match fails, throw a route not found exception.

[0046] Next, the system needs to extract the routing parameters and inject them into the page's Widget constructor. The parameter processing includes: Parameter source identification: Extract directly passed parameters from the PageRouteInfo object; extract path parameters from the URI path (if path navigation is used); extract query parameters from the URI query string (if path navigation is used). Parameter type conversion: For path parameters and query parameters (i.e., target parameters), they are initially of string type and need to be converted according to the type of the page Widget constructor parameter; basic type conversion is supported (int, double, bool, String); for custom types, the serialization method is called for conversion; Parameter validation: Check if required parameters exist. If a required parameter is missing, throw a parameter missing exception. Check if the parameter type is correct. If the type does not match, attempt type conversion. If conversion fails, throw a type error exception. Parameter injection: Injects the extracted and transformed parameters into the page widget according to the constructor signature; supports named parameters and positional parameters; handles optional parameters and default values.

[0047] Next, after the parameter injection is complete, the system needs to create a Flutter Route object. The creation process includes: Route type selection: Select the route type according to the RouteType in the route configuration. It can be Material style, Cupertino style, adaptive style, or custom style; if not specified, the default route type will be used. Transition animation configuration: Configure transition animations according to route type. Material style uses MaterialPageRoute, and Cupertino style uses CupertinoPageRoute; you can customize transition animations through CustomRoute configuration; Route object creation: Create the corresponding Route object, set the route name, parameters, full-screen dialog flag and other properties to encapsulate the page widget and navigation configuration.

[0048] Finally, the system calls Flutter's Navigator to perform the actual navigation operations. The execution process includes: Navigation operation execution: The corresponding operation is executed based on the method called. `push` calls `Navigator.push`, `replace` calls `Navigator.replace`, and `navigate` intelligently selects the operation based on the route stack. Route stack update: Navigation operations will update the route stack. Push adds a new route to the top of the stack, replace replaces the route at the top of the stack, and navigate may jump to an existing route or add a new route. Observer notification: After navigation is complete, all registered route observers are notified, triggering callbacks such as didPush and didReplace; observers can be used for event tracking, logging, performance monitoring, etc. Result return: If the navigation method returns a Future, wait for the page to return the result; the result is returned via Navigator.pop(result), and the type is safely passed to the caller.

[0049] In summary, the following beneficial effects can be achieved through the above technologies: (1) Reduced type error rate: Type errors are now detected at compile time instead of at runtime, significantly reducing the type error rate; (2) Improved development efficiency: No need for manual type conversion and null checks, reducing boilerplate code; (3) Improved code maintainability: Type-safe routing code is easier to understand and maintain; (4) Reduced code volume: Only a few lines of annotation code need to be written manually; (5) Reduced development time: No need to write and maintain a large amount of boilerplate code, allowing you to focus on business logic; (6) Improved code consistency: The automatically generated code has a uniform format, reducing human error.

[0050] As can be seen, this optional embodiment can obtain target route information based on the route instance invocation command, match the target route configuration information from the route configuration table, and then, after completing parameter conversion and verification, inject the corresponding parameters into the target page component unit and create a path object. This allows the target navigation method to be invoked to update the route stack, and the call result is determined by obtaining information through the route observer. In this way, parameter type safety is ensured through parameter processing, reducing runtime parameter errors and thus improving the reliability, accuracy, and stability of Flutter route navigation. Simultaneously, the implementation of functions such as event tracking and statistics through the route observer facilitates project monitoring and optimization, reduces development complexity, and thus improves development efficiency.

[0051] In yet another optional embodiment, after matching the target route configuration information from the route configuration table corresponding to the route instance based on the target route information, the method further includes: Create a route guard chain for the Flutter project based on the route guard implementation information and the target route configuration information; By using the route guard chain, the navigation execution method that matches the target route configuration information is called, and the result of the navigation execution method call is obtained; When the result of the navigation execution method call indicates that navigation is allowed, the operation of type conversion of the target parameter in the target route configuration information is triggered to obtain the converted parameter.

[0052] In this optional embodiment, prior to navigation, the system may execute a routing guard chain to check whether navigation is permitted. The guard check process includes: Guard chain construction: First, collect global guards, which are applied to all routes; then collect route-level guards, which are applied only to the current route; merge the two types of guards into a guard chain and execute them in sequence; Guard execution: Each guard is executed sequentially. Each guard receives a NavigationResolver object and the current router instance. Guards can be executed synchronously or asynchronously (returning a Future). Guard decision: Each guard allows navigation by calling resolver.next(true), denies navigation by calling resolver.next(false), or performs a redirection by calling resolver.redirectUntil(); if a guard denies navigation, subsequent guards will not be executed. Exception handling: If an exception is thrown during the execution of the guard, navigation is canceled and the exception information is passed to the caller.

[0053] In summary, the following beneficial effects can be achieved through the above technologies: (1) Reduced code duplication for route guards: The process has been changed from manually adding inspection logic to each route to a unified configuration; (2) Reduced maintenance costs for route guards: Unified guard management facilitates maintenance and updates; (3) Reduced error rate of routing guards: Unified execution process reduces logical errors.

[0054] As can be seen, this optional embodiment, after matching the target route configuration information from the route configuration table, creates a route guard chain based on the route guard implementation information to call the matched navigation execution method. If navigation is allowed, it then triggers the type conversion operation of the target parameter and the formal invocation of the target navigation method. In this way, by constructing a route guard chain and performing a comprehensive check before navigation, illegal navigation requests can be effectively intercepted, enhancing the security and flexibility of Flutter route navigation and ensuring application security. Simultaneously, it supports synchronous and asynchronous execution of guards, meeting the needs of complex business scenarios, making the navigation process more controllable, avoiding unnecessary navigation operations, thereby improving user experience and development quality.

[0055] Example 2 Please see Figure 2 , Figure 2 This is a flowchart illustrating another Flutter navigation method based on strongly typed routing disclosed in an embodiment of the present invention. Optionally, this method can be implemented by a Flutter navigation device, which can be integrated into a terminal device (such as a smart computer, smart tablet, or smartphone), or it can be a local server or cloud server used to process the Flutter navigation process based on strongly typed routing, etc., and the embodiments of the present invention do not limit this. Furthermore, this method can be applied to terminal devices with Flutter projects installed, and the terminal device can communicate with a network-attached storage device. Wherein, such as Figure 2 As shown, this Flutter navigation method based on strongly typed routes can include the following operations: 201. Based on the preset file extension scanning requirements, scan the source code files of the Flutter project to obtain the target page component units and route configuration parameters of the Flutter project.

[0056] 202. Based on the target page component units and routing configuration parameters, determine the router implementation information of the Flutter project, and generate a routing instance for the Flutter project based on the router implementation information.

[0057] 203. Receive the deep links of the Flutter project, and perform target transformation on the deep links to obtain the transformed links.

[0058] In this embodiment of the invention, the target transformation operation may optionally include at least one of the following: prefix stripping operation, path rewriting operation, and parameter transformation operation.

[0059] For example, it can be understood as follows: First, the application receives the deep link URI. The application receives the deep link URI from the platform (Android, iOS, Web). The receiving process includes: Platform notification: Android receives deep links via Intent, iOS receives them via URL Scheme or UniversalLinks, and the web receives them via the browser address bar; the URI format may differ across platforms and needs to be handled uniformly. URI format standardization: Convert URI formats from different platforms into a unified URI object, extracting parts such as scheme, host, path, and query; process URI encoding to ensure correct parsing of special characters; In-application deep links: In addition to platform deep links, deep links may also be triggered within the application, for example, through the router.pushPath() method; the processing flow of internal deep links is the same as that of platform deep links.

[0060] Next, URI transformation is performed. If DeepLinkTransformer is configured, the system will transform the URI. The transformation process includes: Prefix stripping: If the URI path contains a specific prefix (such as / prefix), the converter can be configured to automatically strip the prefix; for example, / prefix / products / 123 is converted to / products / 123. Path rewriting: You can configure path rewriting rules to map old paths to new paths; for example, rewriting / old-path to / new-path. Parameter conversion: You can convert query parameters, such as converting parameter names from lowercase to camelCase; you can add default parameters, such as adding version parameters for all deep links.

[0061] 204. Perform target verification on the converted link to obtain the verification result of the converted link.

[0062] In this embodiment of the invention, optionally, the target verification operation includes at least one of the following: path whitelist check operation, permission check operation, and parameter validity verification operation.

[0063] In this embodiment of the invention, for example, it can be understood that if DeepLinkBuilder is configured, the system will verify the URI. The verification process includes: Path whitelist check: Checks if the URI path is in the list of allowed paths; if it is not in the whitelist, access can be denied or redirected to the default path; Permission check: Checks whether the current user has permission to access the path; for example, some paths require login to access, and unlogged users will be redirected to the login page; Parameter validation: Validate whether the parameters in the URI are valid, such as checking whether the ID parameter is a valid number; if the parameter is invalid, access can be denied or a default value can be used.

[0064] 205. When the verification result of the converted link indicates that the converted link is normal, match the link route configuration information of the converted link from the route configuration table according to the converted link, and extract the path parameters and query parameters from the link route configuration information.

[0065] In this embodiment of the invention, for example, it can be understood as: the system searches for a matching route in the routing configuration table based on the URI path. The matching process includes: Exact match: First, try an exact match to find route configurations with exactly the same path; this is the fastest matching method. Prefix matching: If an exact match fails, try prefix matching to find routes whose paths are prefixes of the URI path; for example, / products matches / products / 123; prefix matching requires includePrefixMatches to be configured as true; Wildcard matching: If wildcard routes (path is *) are configured, all unmatched paths can be matched; wildcard routes are typically used for 404 pages. Matching result processing: If the match is successful, retrieve the route configuration and the matched path parameters; if the match fails, use wildcard routing or return a 404 error.

[0066] 206. Determine the navigation type of the Flutter project based on the path parameters and query parameters, and perform the target navigation operation on the Flutter project according to the navigation type.

[0067] In this embodiment of the invention, the navigation type further includes a nested navigation type or a tab navigation type.

[0068] For example, this can be understood as follows: First, extract path parameters and query parameters from the matched routes. The extraction process includes: Path parameter extraction: Extract values ​​of dynamic path segments based on the routing path pattern; for example, if the path pattern / products / :id matches the path / products / 123, extract id=123; the path parameter name matches the @PathParam annotation; Query parameter extraction: Extract key-value pairs from the URI query string; for example, the query string ?name=book&price=29.99 extracts name=book and price=29.99; the query parameter names are matched with the @QueryParam annotation; Parameter type conversion: Converts the extracted string parameters to the target type; supports basic type conversion, custom types require serialization methods.

[0069] Next, a complete route stack is built based on the matched routes. The building process includes: Linear route stack construction: If the routes are linear (non-nested), construct a simple route stack containing all routes from the root route to the target route; for example, / -> / products -> / products / 123; Nested route stack construction: If the routes are nested, a nested route stack needs to be built; both parent and child routes need to be added to the stack; for example, / dashboard -> / dashboard / products -> / dashboard / products / 123; Route stack optimization: If some routes already exist in the route stack, existing routes can be reused instead of creating new ones; this can maintain route state and improve performance.

[0070] Finally, a complete route stack is built based on the matched routes. The building process includes: Linear route stack construction: If the routes are linear (non-nested), construct a simple route stack containing all routes from the root route to the target route; for example, / -> / products -> / products / 123; Nested route stack construction: If the routes are nested, a nested route stack needs to be built; both parent and child routes need to be added to the stack; for example, / dashboard -> / dashboard / products -> / dashboard / products / 123; Route stack optimization: If some routes already exist in the route stack, existing routes can be reused instead of creating new ones; this can maintain route state and improve performance.

[0071] In summary, the following beneficial effects can be achieved through the above technologies: (1) Deep link development time is shortened: from manually writing URI parsing code to automatic processing with zero configuration; (2) Reduced error rate in deep linking: Automated processing reduces human error; (3) Reduced maintenance cost of deep links: No need to maintain complex URI parsing logic.

[0072] In this embodiment of the invention, for other descriptions of steps 205 and 206, please refer to the detailed description of steps 102 and 103 in Embodiment 1. These descriptions will not be repeated in this embodiment of the invention.

[0073] As can be seen, implementing this embodiment of the invention first scans the Flutter project source code files to obtain target page component units and route configuration parameters, generating route instances; then it receives deep links and performs parameter conversion and verification. After successful parameter verification and matching of link route configuration information, it extracts parameters and determines the navigation type based on the parameters to construct a route stack and execute the target navigation operation. In this way, through deep link processing, it can adapt to multiple platforms, achieving seamless navigation inside and outside the application, thereby improving the flexibility and accuracy of Flutter project route navigation. Simultaneously, through parameter extraction and type conversion, it ensures reliable navigation basis, and the constructed route stack can handle different navigation types, optimizing the navigation process, reducing the duplication of route creation, and providing users with a smoother user experience.

[0074] In an optional embodiment, a target navigation operation is performed on the Flutter project based on the navigation type, including: When the navigation type includes nested navigation types, the parent and child routes of the Flutter project are constructed based on the link route configuration information to obtain the nested router of the Flutter project; Render the nested router to obtain the rendered nested router, and then use the router instance corresponding to the rendered nested router to perform parent route navigation operations or child route navigation operations on the Flutter project.

[0075] In this optional embodiment, the rendered nested router includes a rendered parent route and a rendered child route; and the constructor parameter of the rendered child route is inherited from the path parameter of the rendered parent route.

[0076] For example, this nested navigation flow can be understood as follows: Step 1: Define nested route configuration Define a nested routing structure in the router configuration. The configuration process includes: Parent route definition: Define the parent route, such as DashboardRoute, with the path / dashboard; the parent route is usually a container page that contains the AutoRouter Widget for rendering child routes; Child route definition: Child routes are defined in the children property of the parent route, such as UsersRoute, PostsRoute, and SettingsRoute; the path of the child route is relative to the parent route, such as users, posts, and settings; Routing hierarchy: The system builds a routing tree structure based on the configuration, with the parent route being the root node and the child routes being the child nodes; multi-level nesting is supported, and child routes can also have their own child routes.

[0077] Step 2: Rendering the nested router Create a nested route context using the AutoRouter Widget on the parent page. The rendering process includes: AutoRouter Widget creation: Create the AutoRouter Widget in the parent page's build method; the AutoRouter Widget will automatically create nested route contexts, isolating parent and child routes; Route context creation: The AutoRouter Widget creates a new StackRouter instance to manage the navigation stack of child routes; this router is a child router of the parent router and can be accessed through the parent property; Sub-route rendering: The AutoRouter Widget renders the corresponding page widget based on the current sub-route; if there is no current sub-route, it can render the default sub-route or an empty page.

[0078] Step 3: Navigate to the sub-route Navigate to sub-routes via nested routers. The navigation process includes: Router retrieval: The current router instance is obtained through context.router; if the current page is in the parent page, the nested router is obtained; if the current page is in the child page, the nested router (same instance) is also obtained. Navigation method call: Call the push method of the nested router, passing in the PageRouteInfo object of the child route; for example, router.push(UsersRoute()); Route matching: Nested routers search for matching sub-routes in their own routing configurations; the matching process is the same as that of the root router, but only the sub-route configurations are searched; Navigation Execution: Perform navigation operations, push child routes onto the navigation stack of nested routers; update the state of nested routers and notify route observers.

[0079] Step 4: Parameter Passing Child routes can inherit path parameters from their parent routes. The transmission process includes: Parameter inheritance mechanism: If the constructor parameter of a child route uses the @PathParam.inherit annotation, the parameter will be inherited from the path parameter of the parent route; for example, if the parent route path is / product / :id, the child route can inherit the id parameter. Parameter overriding mechanism: Subroutines can also define their own path parameters, overriding inherited parameters; for example, if the subroutine path is / product / :id / review / :reviewId, then reviewId is the subroutine's own parameter. Parameter passing process: When navigating to a sub-route, the system first extracts the path parameters from the parent route, then extracts the path parameters from the sub-route path, and finally merges the parameters and injects them into the sub-route page widget.

[0080] Step 5: Results Return Child routes can return results to their parent routes using the `pop` method. The return process includes: Result settings: The child route calls router.pop(result) to return the result, which can be an object of any type; the result will be passed to the parent route's await expression; Route stack update: The pop operation removes the current child route from the navigation stack of the nested router; if the nested router's stack is empty, the parent route can choose how to handle it (display the default child route or an empty page); Result passing: If the parent route waits for the child route to return via await router.push(ChildRoute()), the result will be passed to the await expression; the parent route can then process the result, such as updating the UI or performing other operations.

[0081] In summary, the following beneficial effects can be achieved through the above technologies: (1) Reduced code size for nested navigation: Reduced from manually managing multiple Navigators to using AutoRouterWidget; (2) Reduced error rate in nested navigation: Automated management reduces routing confusion; (3) Shorter development time for nested navigation: Simplified API reduces learning costs.

[0082] As can be seen, this optional embodiment can construct parent and child routes to obtain a nested router based on the linked route configuration information when the navigation type is nested navigation, render the router, and then execute parent or child route navigation operations through the router instance. The child route constructor parameters can inherit the parent route path parameters, and the child route can return results to the parent route. This clearly defines the parent-child route hierarchy, reducing interference between different route levels. Simultaneously, the parameter inheritance and overriding mechanism simplifies data transmission, ensures data accuracy, facilitates timely response and processing by the parent route, improves the user experience, and optimizes project structure and development efficiency.

[0083] In another alternative embodiment, a target navigation operation is performed on the Flutter project based on the navigation type, including: When the navigation type includes the Tab navigation type, construct the parent route and Tab route of the Flutter project based on the link route configuration information; Create an automatic tab route instance in the parent page of the parent route, and switch the active tab in the Flutter project using the automatic tab route instance and preset transition animation configuration parameters to perform tab navigation operations in the Flutter project.

[0084] In this optional embodiment, for example, the Tab navigation process can be understood as follows: Step 1: Define Tab routing configuration Define the Tab routing structure in the router configuration. The configuration process includes: Parent route definition: Define the parent route, such as HomeRoute, with the path / home; the parent route is a container page that contains AutoTabsRouter for managing tab switching; Tab route definition: Define tab routes in the children property of the parent route, such as BooksTab, ProfileTab, and SettingsTab; the path of a tab route is relative to the parent route; Tab routing features: Tab routing supports lazy loading. By default, tab pages are only built on the first visit; a preloading strategy can be configured to build tab pages in advance.

[0085] Step 2: Create AutoTabsRouter Create an AutoTabsRouter instance on the parent page. The creation process includes: AutoTabsRouter initialization: Creates an AutoTabsRouter instance, passing in a list of tab routes; for example, AutoTabsRouter(routes: [BooksTab(), ProfileTab(), SettingsTab()]); Tab state initialization: AutoTabsRouter initializes the tab state, sets the default active tab (usually the first tab), and creates a tab route manager to manage the state of each tab. Lazy loading mechanism: If lazy loading is enabled, tab pages are built only on the first visit; if lazy loading is disabled, all tab pages are built on initialization.

[0086] Step 3: Tab Switching When a user clicks a tab or a code-invoked switching method occurs, AutoTabsRouter toggles the active tab. The switching process includes: Switching is triggered when a user clicks a tab in the tab bar, or when the tabsRouter.setActiveIndex(index) method is called in the code; AutoTabsRouter receives the switching request. Active Tab Update: AutoTabsRouter updates the active tab index, sets new tabs as active tabs, and sets old tabs as inactive tabs; it also updates the state of the tab routing manager. Tab page construction: If the new tab page has not yet been built (lazy loading), the tab page is built at this time; if the tab page has already been built, it is displayed directly. UI Update: Updated the selected state of the Tab bar, highlighting the active Tab; updated the Tab content area, displaying the page of the active Tab.

[0087] Step 4: Maintaining the State Inactive tabs remain in a state, while active tabs are displayed on the screen. The state retention process includes: Offstage mechanism: Page widgets of inactive tabs are wrapped with offstage widgets, which are set to invisible but retain their state; offstage widgets do not destroy their child widgets, thus maintaining the widget tree and state; State retention: The state of the tab page (including ScrollController, TextEditingController, etc.) is retained when switching tabs; when the user switches back to the tab, the page state is fully restored; Memory management: If tab pages consume a lot of memory, you can configure the release of resources for inactive tabs when switching tabs; this requires a balance between state preservation and memory management.

[0088] Step 5: Transition Animation A transition animation is executed when switching tabs. The animation process includes: Animation configuration: AutoTabsRouter supports custom transition animations, which can be configured via the transitionBuilder parameter; the default is to use fade-in and fade-out animations. Animation execution: When switching tabs, the old tab page executes an exit animation, and the new tab page executes an entry animation; the animation duration is configurable, with a default of 300 milliseconds; Animation optimization: During animation execution, tab pages may exist simultaneously (exiting the old page and entering the new page). It is necessary to manage the widget tree properly to avoid performance issues.

[0089] In summary, the following beneficial effects can be achieved through the above technologies: (1) Reduced Tab navigation code: from manually managing Tab states to using AutoTabsRouter; (2) Improved Tab Navigation Performance: Lazy Loading Mechanism Reduces Unnecessary Page Building; (3) Shorter development time for Tab navigation: Simplified API reduces implementation complexity.

[0090] As can be seen, this optional embodiment can construct parent routes and tab routes based on link route configuration information when the navigation type is tab navigation, and create an automatic tab route instance on the parent page. This instance, along with preset transition animation configuration parameters, switches the active tab when triggered by the user or called by code, while simultaneously maintaining the state of inactive tabs and managing memory. In this way, the introduction of the automatic tab route instance achieves centralized and unified management of tab switching, greatly simplifying the operation process and allowing developers to focus more on business logic implementation. Secondly, the lazy loading mechanism effectively saves resources and avoids unnecessary page construction, while the state preservation function ensures the continuity of the user experience when switching between different tabs, preventing loss of operation state due to page reloading. Furthermore, the addition of custom transition animations adds a dynamic aesthetic to the interaction, enhancing the user's visual experience. Finally, a reasonable memory management strategy strikes a balance between performance and resource consumption, ensuring stable and efficient operation of the project in various scenarios, comprehensively enhancing the project's competitiveness.

[0091] Example 3 Please see Figure 3 , Figure 3 This is a schematic diagram of a Flutter navigation device based on strongly typed routing, as disclosed in an embodiment of the present invention. Furthermore, this device is applied to a terminal device with a Flutter project installed, and the terminal device is capable of communicating with a network-attached storage device. Wherein, the... Figure 3 As shown, the Flutter navigation device based on strongly typed routes may include: The scanning module 301 is used to scan the source code files of the Flutter project according to the preset file extension scanning requirements parameters to obtain the target page component units and routing configuration parameters of the Flutter project. Module 302 is used to determine the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters. The generation module 303 is used to generate route instances for the Flutter project based on the router implementation information. Receive module 304 is used to receive routing instance invocation instructions from a Flutter project; Navigation module 305 is used to call the target navigation method in the route instance according to the route instance call instruction, and obtain the call result of the target navigation method to complete the navigation process of the target page of the Flutter project.

[0092] In this embodiment of the invention, the router implementation information includes at least a routing configuration table, link processing logic information, and navigation method implementation information.

[0093] It is evident that implementation Figure 3 The described Flutter navigation device based on strongly typed routing enables intelligent navigation of target pages, effectively improving the reliability, accuracy, and stability of navigation in Flutter projects and enhancing the quality of routing navigation in Flutter projects. At the same time, it also reduces the development complexity of routing navigation technology and improves the development efficiency of routing navigation technology in Flutter projects.

[0094] In an optional embodiment, the method by which the determining module 302 determines the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters specifically includes: Perform static analysis on the target page component units to obtain the static analysis results of the target page component units; Based on the static analysis results and routing configuration parameters, generate the page routing information class for the target page component unit; Based on the page routing information class, determine the router implementation information of the Flutter project.

[0095] In this optional embodiment, the static analysis results include at least one of class structure analysis results, constructor analysis results, annotation identification results, and parameter type analysis results. The class structure analysis results include component unit class inheritance relationship information and / or component unit class visibility information. The page routing information class includes at least one of route name class, route path class, constructor parameter attribute class, and navigation method class.

[0096] It is evident that implementation Figure 4The described strongly typed routing-based Flutter navigation device performs static analysis on target page component units and generates page routing information classes for these units based on the analysis results and routing configuration parameters. This determines the router implementation information for the Flutter project. This improves the reliability and accuracy of generating page routing information classes for target page component units, thereby enhancing the reliability, accuracy, and efficiency of determining the router implementation information for the Flutter project. Ultimately, this facilitates the accurate and efficient generation of routing instances for the Flutter project.

[0097] In another optional embodiment, the route instance invocation instructions of the Flutter project include at least one of the route push method invocation instructions, route replacement method invocation instructions, and route smart navigation method invocation instructions; Specifically, the calling module invokes the target navigation method in the route instance based on the route instance's invocation instruction, and obtains the invocation result of the target navigation method in the following ways: Based on the routing instance invocation command, obtain the target route information in the routing instance invocation command, and based on the target route information, match the target route configuration information from the routing configuration table corresponding to the routing instance; Perform a type conversion operation on the target parameters in the target route configuration information to obtain the converted parameters, and verify the converted parameters to obtain the verification results of the converted parameters; When the verification result indicates that the converted parameters are normal, the target parameters and the converted parameters are injected into the target page component unit of the Flutter project; After injection is complete, the page style parameters of the Flutter project are determined based on the target route configuration information, and the path object of the Flutter project is created based on the page style parameters; After creation, the target navigation method in the route instance is called based on the target route information to update the route stack in the Flutter project; By using pre-defined route observers, project observation information of the Flutter project is obtained, and the call result of the target navigation method is determined based on the project observation information.

[0098] In this optional embodiment, the target route information includes target route name information and / or target route path information; the target route configuration information includes at least one of page component unit type configuration information, path mode configuration information, and sub-route configuration information; and the project observation information includes at least one of event tracking statistics, log records, and performance information.

[0099] It is evident that implementation Figure 4The described Flutter navigation device based on strongly typed routing can obtain target route information by calling instructions from route instances. It then matches the target route configuration information from the route configuration table, performs parameter conversion and verification, injects the corresponding parameters into the target page component unit, creates a path object, and calls the target navigation method to update the route stack. The result is determined by obtaining information through a route observer. This parameter handling ensures parameter type safety, reduces runtime parameter errors, and improves the reliability, accuracy, and stability of Flutter route navigation. Simultaneously, the route observer enables features such as event tracking and statistics, facilitating project monitoring and optimization, reducing development complexity, and thus improving development efficiency.

[0100] In yet another optional embodiment, the router implementation information further includes route guard implementation information; The calling module is also used for: After matching the target route configuration information from the route configuration table corresponding to the route instance based on the target route information, a route guard chain is created for the Flutter project based on the route guard implementation information and the target route configuration information. By using the route guard chain, the navigation execution method that matches the target route configuration information is called, and the result of the navigation execution method call is obtained; When the result of the navigation execution method call indicates that navigation is allowed, the operation of type conversion of the target parameter in the target route configuration information is triggered to obtain the converted parameter.

[0101] It is evident that implementation Figure 4 The described Flutter navigation device based on strongly typed routing can, after matching the target route configuration information from the route configuration table, create a route guard chain based on the route guard implementation information to call the matching navigation execution method. If navigation is allowed, it then triggers the type conversion operation of the target parameter and the formal invocation of the target navigation method. In this way, by constructing a route guard chain and performing a comprehensive check before navigation, illegal navigation requests can be effectively intercepted, enhancing the security and flexibility of Flutter route navigation and ensuring application security. Simultaneously, it supports synchronous and asynchronous execution of guards, which can meet the needs of complex business scenarios, making the navigation process more controllable, avoiding unnecessary navigation operations, and thus improving user experience and development quality.

[0102] In yet another optional embodiment, the link processing logic information includes deep link processing logic information; In addition, the receiving module 304 is also used for: Receive deep links from Flutter projects; The device also includes: The conversion module 306 is used to perform target conversion operations on deep links to obtain the converted links; The verification module 307 is used to perform target verification operations on the converted link and obtain the verification result of the converted link; The matching module 308 is used to match the link routing configuration information of the converted link from the routing configuration table when the verification result of the converted link indicates that the converted link is normal. Extraction module 309 is used to extract path parameters and query parameters from the link routing configuration information; Module 302 is also used to determine the navigation type of a Flutter project based on path parameters and query parameters; Navigation module 305 is also used to perform target navigation operations on the Flutter project based on the navigation type.

[0103] In this optional embodiment, the target transformation operation includes at least one of prefix stripping operation, path rewriting operation, and parameter transformation operation; the target verification operation includes at least one of path whitelist checking operation, permission checking operation, and parameter validity verification operation; the navigation type includes nested navigation type or tab navigation type.

[0104] It is evident that implementation Figure 4 The described Flutter navigation device based on strongly typed routing first scans the Flutter project's source code files to obtain target page component units and route configuration parameters, generating route instances. It then receives deep links, performs parameter conversion and verification, and if the parameter verification is successful, matches the link route configuration information. Parameters are then extracted, and the navigation type is determined based on the parameters to build a route stack and execute the target navigation operation. This deep linking process enables multi-platform adaptation and seamless navigation both inside and outside the application, improving the flexibility and accuracy of Flutter project route navigation. Simultaneously, parameter extraction and type conversion ensure reliable navigation, and the constructed route stack can handle different navigation types, optimizing the navigation process, reducing redundant route creation, and providing a smoother user experience.

[0105] In yet another optional embodiment, the navigation module 305 performs target navigation operations on the Flutter project according to the navigation type, specifically including: When the navigation type includes nested navigation types, the parent and child routes of the Flutter project are constructed based on the link route configuration information to obtain the nested router of the Flutter project; Render the nested router to obtain the rendered nested router, and then use the router instance corresponding to the rendered nested router to perform parent route navigation operations or child route navigation operations on the Flutter project.

[0106] In this optional embodiment, the rendered nested router includes a rendered parent route and a rendered child route, wherein the constructor parameters of the rendered child route are inherited from the path parameters of the rendered parent route.

[0107] It is evident that implementation Figure 4 The described Flutter navigation device based on strongly typed routing can construct parent and child routes to obtain a nested router when the navigation type is nested navigation, based on the linked route configuration information, render the router, and then execute parent or child route navigation operations through the router instance. The child route constructor parameters can inherit the parent route path parameters, and the child route can return results to the parent route. This clearly defines the parent-child route hierarchy, reducing interference between different route levels. At the same time, the parameter inheritance and overriding mechanism simplifies data transmission, ensures data accuracy, facilitates timely response from the parent route, improves the user experience, and optimizes project structure and development efficiency.

[0108] In yet another optional embodiment, the navigation module 305 performs target navigation operations on the Flutter project according to the navigation type, specifically including: When the navigation type includes the Tab navigation type, construct the parent route and Tab route of the Flutter project based on the link route configuration information; Create an automatic tab route instance in the parent page of the parent route, and switch the active tab in the Flutter project using the automatic tab route instance and preset transition animation configuration parameters to perform tab navigation operations in the Flutter project.

[0109] It is evident that implementation Figure 4The described Flutter navigation device based on strongly typed routing can construct parent and tab routes based on link route configuration information when the navigation type is tab navigation. It then creates an automatic tab route instance on the parent page, using this instance and preset transition animation configuration parameters to switch active tabs when triggered by the user or called by code, while simultaneously maintaining the state of inactive tabs and managing memory. This introduction of automatic tab route instances achieves centralized and unified management of tab switching, greatly simplifying the operation process and allowing developers to focus more on business logic implementation. Secondly, the lazy loading mechanism effectively saves resources and avoids unnecessary page construction, while the state preservation function ensures the continuity of the user experience when switching between different tabs, preventing loss of operation state due to page reload. Furthermore, the addition of custom transition animations adds a dynamic aesthetic to the interaction, enhancing the user's visual experience. Finally, a reasonable memory management strategy strikes a balance between performance and resource consumption, ensuring stable and efficient operation of the project in various scenarios, comprehensively enhancing the project's competitiveness.

[0110] Example 4 Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of the terminal device disclosed in an embodiment of the present invention. Figure 5 As shown, the terminal device may include: Memory 401 storing executable program code; Processor 402 coupled to memory 401; The processor 402 calls the executable program code stored in the memory 401 to execute the steps in the Flutter navigation method based on strongly typed routing described in Embodiment 1 or Embodiment 2 of the present invention.

[0111] Example 5 This invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute the steps in the Flutter navigation method based on strongly typed routing described in Embodiment 1 or Embodiment 2 of this invention.

[0112] Example 6 This invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the strongly typed routing-based Flutter navigation method described in Embodiment 1 or Embodiment 2.

[0113] Example 7 Please see Figure 6 , Figure 6This invention discloses a Flutter navigation system based on strongly typed routing. The system includes the Flutter navigation device 501 based on strongly typed routing disclosed in Embodiment 3 of this invention, and a network-attached storage device 502 communicatively connected to the device 501; or, the system includes a terminal device 501 disclosed in Embodiment 4 of this invention, and a network-attached storage device 502 communicatively connected to the terminal device 501.

[0114] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0115] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0116] Finally, it should be noted that the Flutter navigation method, apparatus, and system based on strongly typed routing disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention and are only used to illustrate the technical solutions of the present invention, not to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features therein; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A Flutter navigation method based on strongly typed routing, the method being applied to a terminal device with a Flutter project installed, wherein the terminal device is capable of communicating with a network-attached storage device, characterized in that, The method includes: Based on preset file extension scanning requirements parameters, the source code files of the Flutter project are scanned to obtain the target page component units and routing configuration parameters of the Flutter project; Based on the target page component unit and the routing configuration parameters, the router implementation information of the Flutter project is determined, and a routing instance of the Flutter project is generated based on the router implementation information; the router implementation information includes at least a routing configuration table, link processing logic information, and navigation method implementation information; The system receives a route instance invocation instruction from the Flutter project, and invokes the target navigation method in the route instance according to the route instance invocation instruction to obtain the invocation result of the target navigation method, thereby completing the navigation process of the target page of the Flutter project.

2. The Flutter navigation method based on strongly typed routing according to claim 1, characterized in that, The step of determining the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters includes: Static analysis is performed on the target page component unit to obtain the static analysis results of the target page component unit; the static analysis results include at least one of class structure analysis results, constructor analysis results, annotation identification results, and parameter type analysis results, and the class structure analysis results include component unit class inheritance relationship information and / or component unit class visibility information; Based on the static analysis results and the routing configuration parameters, a page routing information class for the target page component unit is generated; the page routing information class includes at least one of a route name class, a route path class, a constructor parameter attribute class, and a navigation method class; Based on the page routing information class, determine the router implementation information of the Flutter project.

3. The Flutter navigation method based on strongly typed routing according to claim 1 or 2, characterized in that, The Flutter project's route instance invocation instructions include at least one of the following: route push method invocation instructions, route replacement method invocation instructions, and route smart navigation method invocation instructions; The step of invoking the target navigation method in the route instance according to the route instance invocation instruction, and obtaining the invocation result of the target navigation method, includes: According to the route instance invocation instruction, the target route information in the route instance invocation instruction is obtained, and the target route configuration information is matched from the route configuration table corresponding to the route instance according to the target route information; the target route information includes target route name information and / or target route path information, and the target route configuration information includes at least one of page component unit type configuration information, path mode configuration information, and sub-route configuration information; Perform a type conversion operation on the target parameters in the target route configuration information to obtain converted parameters, and verify the converted parameters to obtain the verification result of the converted parameters; When the verification result indicates that the converted parameters are normal, the target parameters and the converted parameters are injected into the target page component unit of the Flutter project; After injection is complete, the page style parameters of the Flutter project are determined according to the target route configuration information, and the path object of the Flutter project is created according to the page style parameters; After creation, based on the target route information, the target navigation method in the route instance is called to update the route stack in the Flutter project; The project observation information of the Flutter project is obtained through a preset route observer, and the call result of the target navigation method is determined based on the project observation information; the project observation information includes at least one of the following: event tracking statistics, log records, and performance information.

4. The Flutter navigation method based on strongly typed routing according to claim 3, characterized in that, The router implementation information also includes route guard implementation information; The method further includes, after matching the target route configuration information from the route configuration table corresponding to the route instance based on the target route information: Based on the route guard implementation information and the target route configuration information, create the route guard chain of the Flutter project; By using the route guard chain, the navigation execution method that matches the target route configuration information is invoked, and the invocation result of the navigation execution method is obtained; When the navigation execution method call result indicates that navigation is allowed, the operation of converting the target parameters in the target route configuration information to obtain the converted parameters is triggered.

5. The Flutter navigation method based on strongly typed routing according to claim 1, characterized in that, The link processing logic information includes deep link processing logic information; Furthermore, the method further includes: Receive the deep link of the Flutter project, and perform a target transformation operation on the deep link to obtain the transformed link; the target transformation operation includes at least one of prefix stripping operation, path rewriting operation, and parameter transformation operation; The converted link is subjected to a target verification operation to obtain the verification result of the converted link; the target verification operation includes at least one of path whitelist check operation, permission check operation, and parameter validity verification operation; When the verification result of the converted link indicates that the converted link is normal, the link route configuration information of the converted link is matched from the route configuration table according to the converted link, and the path parameters and query parameters in the link route configuration information are extracted. Based on the path parameters and the query parameters, the navigation type of the Flutter project is determined, and a target navigation operation is performed on the Flutter project according to the navigation type; the navigation type includes nested navigation type or tab navigation type.

6. The Flutter navigation method based on strongly typed routing according to claim 5, characterized in that, The step of performing a target navigation operation on the Flutter project according to the navigation type includes: When the navigation type includes the nested navigation type, the parent route and child route of the Flutter project are constructed according to the link route configuration information to obtain the nested router of the Flutter project; The nested router is rendered to obtain a rendered nested router, and a parent route navigation operation or a child route navigation operation is performed on the Flutter project through the router instance corresponding to the rendered nested router. The rendered nested router includes a rendered parent route and a rendered child route, and the constructor parameters of the rendered child route are inherited from the path parameters of the rendered parent route.

7. The Flutter navigation method based on strongly typed routing according to claim 5, characterized in that, The step of performing a target navigation operation on the Flutter project according to the navigation type includes: When the navigation type includes the Tab navigation type, the parent route and Tab route of the Flutter project are constructed according to the link route configuration information; An automatic tab route instance is created in the parent page of the parent route, and the active tabs in the Flutter project are switched using the automatic tab route instance and preset transition animation configuration parameters to perform tab navigation operations on the Flutter project.

8. A Flutter navigation device based on strongly typed routing, the device being applied to a terminal device with a Flutter project installed, and the terminal device being able to communicate with a network-attached storage device, characterized in that, The device includes: The scanning module is used to scan the source code files of the Flutter project according to preset file extension scanning requirements parameters to obtain the target page component units and routing configuration parameters of the Flutter project. The determination module is used to determine the router implementation information of the Flutter project based on the target page component unit and the routing configuration parameters; The generation module is used to generate a route instance of the Flutter project based on the router implementation information; the router implementation information includes at least a route configuration table, link processing logic information, and navigation method implementation information. The receiving module is used to receive the routing instance invocation instructions of the Flutter project; The navigation module is used to call the target navigation method in the route instance according to the route instance call instruction, and obtain the call result of the target navigation method to complete the navigation process of the target page of the Flutter project.

9. A terminal device, characterized in that, The terminal device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the Flutter navigation method based on strongly typed routing as described in any one of claims 1-7.

10. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, are used to execute the Flutter navigation method based on strongly typed routing as described in any one of claims 1-7.

11. A Flutter navigation system based on strongly typed routing, characterized in that, The system includes the Flutter navigation device based on strongly typed routing as described in claim 8, and a network-attached storage device communicatively connected to the device; or, The system includes a terminal device as described in claim 9, and a network-attached storage device communicatively connected to the terminal device.