shelf_easy

Last updated:

0 purchases

shelf_easy Image
shelf_easy Images
Add to Cart

Description:

shelf easy

Language: English | 中文
This library is a comprehensive lightweight framework, each module can be used independently. Example code directory example Reading navigation:

1. Data model generation module for Json serialization

Model generation
Serialization Demo


2. Unified data operation module for Database
3. Web service module, Websocket service module, supporting client module

Web server
Web client
Websocket server
Websocket client


4. Dart subset virtual machine module, which can be used in Flutter's AOT environment

Generate virtual machine bridge type
Dart subset virtual machine usage
Dart code push solution in Flutter environment


5. Log module
6. Language localization module
7. Server and client in cluster environment

Cluster server
Cluster client
Test process



1. Data model generation module for Json serialization #
Model generation #
The code to generate the Json serialized data model is in the generator.dart file in the example directory.
You can execute dart generator.dart in the example directory to generate the model, and the generated files are in the model directory.
Serialization Demo #
The code demonstrating Json serialization and deserialization is in the test/test_model.dart file in the example directory.
You can execute dart test/test_model.dart in the example directory to view the console output.
2. Unified data operation module for Database #
The code that demonstrates the unified operation of the database is in the test/test_database.dart file in the example directory.
You can execute dart test/test_database.dart in the example directory to view the console output.
Notice:


The database auxiliary classes such as UserQuery generated by the serialization code generator combined with the unified database operation class EasyUniDb can take advantage of the language advantages of dart strong type and avoid Map<String, dynamic> or sql as much as possible Statements associated string key operations.


The interface style of EasyUniDb is basically consistent with that of mongo shell. Currently, it only supports Mongodb, and plans to support postgre.


The sample code is just a demonstration. The result returned by each interface of EasyUniDb is an object of type DbResult<T>. In real scenarios, the status of the database operation result can be judged according to the field of DbResult<T>. For details, please refer to the annotations of the relevant classes.


3. Web service module, Websocket service module, supporting client module #
Web server #
The sample code of the web server is in the test/test_webserver.dart file in the example directory.
The web server can be started by executing dart test/test_webserver.dart in the example directory.
Web client #
The sample code of the web client is in the test/test_webclient.dart file in the example directory.
You can execute dart test/test_webclient.dart in the example directory to initiate a web client call.
Websocket server #
The sample code of the Websocket server is in the test/test_wssserver.dart file in the example directory.
You can execute dart test/test_wssserver.dart in the example directory to start the Websocket server.
Websocket client #
The example code of the example Websocket client is in the test/test_wssclient.dart file in the example directory.
You can execute dart test/test_wssclient.dart in the example directory to initiate a Websocket client call.
4. Dart subset virtual machine module, which can be used in Flutter's AOT environment #
Because the flutter environment cannot push code in the AOT environment, hot update has become a problem. Fortunately, dart officially provides the dart:analyzer code analysis package, and this module is developed based on this package.
Generate virtual machine bridge type #
The code to generate the virtual machine bridge type is in the test/test_vmgen.dart file in the example directory.
Bridge types can be generated by executing dart test/test_vmgen.dart in the example directory. The generated files are in the bridge directory.
Dart subset virtual machine usage #
The code for Dart subset virtual machine usage is in the test/test_vmware.dart file in the example directory.
You can execute dart test/test_vmware.dart in the example directory to view the console output.
Dart code push solution in Flutter environment #
Dart network client library for ZyCloud service zycloud_client
Flutter widget library for ZyCloud service zycloud_widget
Notice:


Some syntaxes of the current virtual machine are not yet compatible, but the compatible syntax is sufficient to meet most requirements.


The author has used this solution to carry out project practice in the production environment. This practice project has achieved 99% of dart code push in the AOT environment.


5. Log module #
The code of the log module is in the test/test_logger.dart file in the example directory.
You can execute dart test/test_logger.dart in the example directory to view the console output information.
6. Language localization module #
The code of the language localization module is in the test/test_locale.dart file in the example directory.
You can execute dart test/test_locale.dart in the example directory to view the console output information.
7. Server and client in cluster environment #
Cluster server #
The code of the cluster server is in the app/app_server.dart file in the example directory.
Notice:


The example server contains two environment configurations: develop and release. You can customize many environment configurations according to actual needs.


The example server contains three service nodes, namely:
Public Web service node http 、
Public Websocket service node outer 、
Internal business service node inner.


Cluster client #
The code of the cluster client is in the app/app_client.dart file in the example directory.
Test process #


Open a new console window and execute dart app/app_server.dart in the example directory to start the server


Open a new console window and execute dart app/app_client.dart 8001 in the example directory to start the persistent connection client of user aaa grouped by cat


Open a new console window, and execute dart app/app_client.dart 8002 in the example directory to start the long-term connection client of user bbb grouped by cat


Open a new console window and execute dart app/app_client.dart 8003 in the example directory to start the persistent connection client of user ccc of the dog group.


At this point, you can observe the output of each console window.


Open a new console window and execute dart app/app_client.dart 8080 in the example directory to start the http client to push data.


At this point, you can observe the output of each console window.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.