bool ifCategoryHaveSubcategories(String id){ for (var item in categories) if (item.parent == id) return true; return false; }