getCategories method

Future<List<ResourceCategory>> getCategories(
  1. ResourceType type, {
  2. String? departmentId,
  3. String? parentCategoryId,
})

Implementation

Future<List<ResourceCategory>> getCategories(ResourceType type,
    {String? departmentId, String? parentCategoryId}) 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);
  }

  return _getCategoryList(await _channel.invokeMethod('getCategories', args));
}