Hello everyone,
I’m excited to share Levee, a pagination engine designed for real-world apps where simple infinite scroll helpers aren’t enough.
Most Flutter pagination packages focus on UI widgets — which is fine for quick demos, but not sufficient in apps with:
We built Levee because we needed a system that wasn’t tied to a widget, scroll listener, or specific backend.
Levee is designed to be:
Levee is not just another infinite scroll helper. It’s a pagination infrastructure layer for robust apps.
Instead of assuming page = int, Levee supports any key type:
class User {}
class TimestampCursor {}
Aathif_Mahir introduces Levee, a backend-agnostic pagination engine for Flutter apps. Levee addresses limitations of existing pagination packages by supporting various pagination types, cache policies, and separation of concerns between data fetching and UI rendering. The thread invites feedback and suggestions for the new package.
This allows:
You implement a single method:
Future<PageData<T, K>> fetchPage(PageQuery<K> query)
This is where your API, database, or service logic lives.
class Post {
final String id;
final String title;
Post({required this.id, required this.title});
}
class PostsDataSource extends DataSource<Post, String> {
@override
Future<PageData<Post, String>> fetchPage(PageQuery<String> query) async {
final response = await http.get(
Uri.parse('https://example.com/posts?cursor=${query.key ?? ''}'),
);
final data = json.decode(response.body);
return PageData(
items: data['items'].map<Post>((d) => Post(id: d['id'], title: d['title'])).toList(),
nextKey: data['nextCursor'],
);
}
}
final paginator = Paginator<Post, String>(
source: PostsDataSource(),
initialKey: null,
);
await paginator.fetchNextPage();
print(paginator.items); // aggregated list
Levee has built-in caching strategies:
NetworkFirstCacheFirstCacheOnlyNetworkOnlyYou can configure cache behavior globally or per request:
paginator.setCachePolicy(CacheFirst());
Levee provides utilities like LeveeBuilder and LeveeCollectionView, but you are free to use your own UI layer.
It works for:
Other Flutter pagination helpers usually:
Levee solves:
Feedback, suggestions, and integration ideas are welcome.