azhon / FlutterModuleBridge

Dart modular development, event communication template generation plug-in. Dart模块化开发,事件通信模板生成插件

Repository from Github https://github.comazhon/FlutterModuleBridgeRepository from Github https://github.comazhon/FlutterModuleBridge

Dart modular development, event communication template generation plugin (AS, IDEA)

  • Menu Tools -> Build Flutter Bridge
  • Or use shortcut keysAlt + B

There are several requirements for the Bridge template

  1. A dart file can only have one class, stored in the lib/ directory
  2. The class must be with Bridge
  3. The method must be annotated with @Url
  4. The method parameter must be Map<String, String>, and the return value must be R or Future<R> type

Examples:

import 'package:module_bridge/module_bridge.dart';

class UserBridge with Bridge {

   @Url(url: '/user/getUserId', desc: 'Get UserId')
   R getUserId(Map<String, String> params) {
     return R.ok(data: 1234);
   }

   @Url(url: '/user/getUserName', desc: 'Get user name')
   Future<R> getUserName(Map<String, String> params) async {
     return R.ok(data: 'azhon');
   }
}

About

Dart modular development, event communication template generation plug-in. Dart模块化开发,事件通信模板生成插件


Languages

Language:Java 100.0%