Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The method 'offset' and 'limit' isn't defined for the type 'QueryBuilder' #116

Open
BodenTide opened this issue Jan 1, 2025 · 1 comment

Comments

@BodenTide
Copy link

Steps to Reproduce

  • Remove the previous isar and isar_flutter_libs versions.
  • Run the following command
  • flutter pub add isar:^4.0.3 isar_flutter_libs:^4.0.3 --hosted-url=https://pub.isar-community.dev
  • added named schemas property to isar open object
  • Run flutter pub run build_runner build

Build runner ran successfully, but I get the following error on queries:

The method 'offset' isn't defined for the type 'QueryBuilder'. (Documentation) Try correcting the name to the name of an existing method, or defining a method named 'offset'.

`@collection
class ReadBookContent {
int? id;
/// md5
String? md5;

/// 大章节
int? chapter;

/// 小章节
int? smallChapter;

ReadBookContent();
}`

List<ReadBookContent> countReadBook = readBookContent.example.where().md5EqualTo(readBookBox.md5).offset(readBookBox.readIndex! - 1).limit(10).findAllSync();

Details

  • Dart version: [3.6.0]
  • Flutter version: [3.27.1]
  • Isar version: [4.0.3]
@chan150
Copy link

chan150 commented Jan 10, 2025

API is changed since v4.
Instead, please use this:

List<ReadBookContent> countReadBook = readBookContent.example.where().md5EqualTo(readBookBox.md5).findAll(offset: readBookBox.readIndex! - 1, limit: 10);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants