getResources method

Future<Result> getResources(
  1. ResourceType type, {
  2. String? departmentId,
  3. String? parentCategoryId,
  4. String? searchKey,
  5. int page = 1,
  6. int limit = 99,
})

Implementation

Future<Result> getResources(ResourceType type,
    {String? departmentId,
    String? parentCategoryId,
    String? searchKey,
    int page = 1,
    int limit = 99}) async {
  int rawValue = type.index;
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent("type", () => rawValue);

  if (departmentId != null) {
    args.putIfAbsent("departmentId", () => departmentId);
  }

  if (parentCategoryId != null) {
    args.putIfAbsent("parentCategoryId", () => parentCategoryId);
  }

  if (searchKey != null) {
    args.putIfAbsent("searchKey", () => searchKey);
  }

  args.putIfAbsent("page", () => page);
  args.putIfAbsent("limit", () => limit);

  return _getResourceResult(
      await _channel.invokeMethod('getResources', args));
}