makeList static method

List<WebRoute> makeList({
  1. required List<String> paths,
  2. required WebRequest rq,
  3. List<String> extraPath = const [],
  4. List<String> methods = const [RequestMethods.GET],
  5. WaController? controller,
  6. Future<String> index()?,
  7. WaAuthController? auth,
  8. List<String> permissions = const [],
  9. String widget = "",
  10. Map<String, Object?> params = const {},
  11. String title = "",
  12. List<String> excludePaths = const [],
  13. List<WebRoute> children = const [],
  14. Future<ApiDoc>? apiDoc()?,
  15. List<String> hosts = const ['*'],
  16. List<int> ports = const [],
})

Creates a list of WebRoute instances from the given parameters.

paths is a list of main paths for the routes. rq is the WebRequest context for the routes. All other parameters have default values.

Returns a list of WebRoute instances.

Implementation

static List<WebRoute> makeList({
  required List<String> paths,
  required WebRequest rq,
  List<String> extraPath = const [],
  List<String> methods = const [RequestMethods.GET],
  WaController? controller,
  Future<String> Function()? index,
  WaAuthController? auth,
  List<String> permissions = const [],
  String widget = "",
  Map<String, Object?> params = const {},
  String title = "",
  List<String> excludePaths = const [],
  List<WebRoute> children = const [],
  Future<ApiDoc>? Function()? apiDoc,
  List<String> hosts = const ['*'],
  List<int> ports = const [],
}) {
  var res = <WebRoute>[];

  for (var path in paths) {
    res.add(WebRoute(
      path: path,
      rq: rq,
      index: index,
      apiDoc: apiDoc,
      auth: auth,
      children: children,
      controller: controller,
      excludePaths: excludePaths,
      extraPath: extraPath,
      methods: methods,
      params: params,
      permissions: permissions,
      title: title,
      widget: widget,
      hosts: hosts,
      ports: ports,
    ));
  }

  return res;
}