Add infinite scroll example#163
Conversation
WalkthroughAdds a new Flutter example "infinite_scroll" (model, controller, UI, manifests, metadata, lints, README) and updates the repository root Changes
Sequence DiagramsequenceDiagram
participant User as User (scroll)
participant UI as PostsList Widget
participant Ctrl as PostController
participant Res as Debounced Resource
participant HTTP as http.Client
participant API as jsonplaceholder.typicode.com
User->>UI: scrolls near bottom
UI->>UI: _onScroll checks threshold
UI->>Ctrl: loadMore()
Ctrl->>Ctrl: update _startIndex (signal)
Ctrl->>Res: signal change triggers debounced fetch (300ms)
Res->>Ctrl: invoke _getPosts()
Ctrl->>HTTP: GET /posts?_start=X&_limit=10
HTTP->>API: request
API-->>HTTP: JSON response
HTTP-->>Ctrl: parsed List<Post>
Ctrl->>Ctrl: append posts or set hasReachedMax
Ctrl-->>UI: postsResource state updates
UI->>User: rebuilds list / loader / error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
examples/infinite_scroll/README.md (1)
1-16: Enhance README with example-specific documentation.The README contains only generic Flutter starter content. For an example project demonstrating infinite scroll with solidart, consider adding:
- A brief description of what the example demonstrates
- Key features showcased (infinite scroll, state management with solidart)
- Instructions on how to run the example
- Explanation of the architecture (PostController, Post model, etc.)
examples/infinite_scroll/lib/controllers/post_controller.dart (2)
14-22: Consider managinghttp.Clientlifecycle explicitly
PostController.providercreates a client that is never closed. In a longer‑lived scope this can leak sockets; consider injecting a shared client from the app root and closing it on app shutdown, or wiring_httpClient.close()into whatever disposal mechanism disco provides for providers.
34-44: Optional: detect end‑of‑list without an extra empty‑page fetchRight now
hasReachedMaxis only set whenresponse.isEmpty. If your backend signals the last page by returning fewer than_postLimititems, you could also sethasReachedMax.value = response.length < _postLimit;to skip one extra network call at the end.examples/infinite_scroll/lib/ui/posts_page.dart (1)
64-66: Optional: center the error message for consistencyThe loading and empty states are centered, but the error state is not. Wrapping the error
Textin aCenterwidget would make the three states visually consistent, if you care about that polish.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
.gitignore(1 hunks)examples/infinite_scroll/.gitignore(1 hunks)examples/infinite_scroll/.metadata(1 hunks)examples/infinite_scroll/README.md(1 hunks)examples/infinite_scroll/analysis_options.yaml(1 hunks)examples/infinite_scroll/lib/controllers/post_controller.dart(1 hunks)examples/infinite_scroll/lib/domain/post.dart(1 hunks)examples/infinite_scroll/lib/main.dart(1 hunks)examples/infinite_scroll/lib/ui/posts_page.dart(1 hunks)examples/infinite_scroll/pubspec.yaml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
examples/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Build and run example applications (counter, todos, github_search, toggle_theme) to validate real user scenarios
Files:
examples/infinite_scroll/lib/domain/post.dartexamples/infinite_scroll/README.mdexamples/infinite_scroll/lib/controllers/post_controller.dartexamples/infinite_scroll/lib/main.dartexamples/infinite_scroll/analysis_options.yamlexamples/infinite_scroll/lib/ui/posts_page.dartexamples/infinite_scroll/pubspec.yaml
🧠 Learnings (7)
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to coverage/lcov.info : Include `coverage/lcov.info` in CI reports
Applied to files:
.gitignore
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/flutter_solidart/test/flutter_solidart_test.dart : After Flutter integration changes, always run `packages/flutter_solidart/test/flutter_solidart_test.dart`
Applied to files:
examples/infinite_scroll/lib/main.dartexamples/infinite_scroll/analysis_options.yamlexamples/infinite_scroll/pubspec.yaml
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/flutter_solidart/{lib,test}/**/*.dart : For Flutter Solidart changes, ensure widget tests cover `SignalBuilder`, `Provider`, and `Show` behaviors
Applied to files:
examples/infinite_scroll/lib/main.dartexamples/infinite_scroll/analysis_options.yamlexamples/infinite_scroll/pubspec.yaml
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Run `flutter analyze packages` to analyze all packages; accept the known 4 lint issues as non-errors
Applied to files:
examples/infinite_scroll/analysis_options.yaml
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/{solidart,flutter_solidart}/lib/**/*.dart : Ensure proper memory management: Signals auto-dispose in Flutter contexts; manually dispose in pure Dart code
Applied to files:
examples/infinite_scroll/analysis_options.yaml
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/solidart_lint/** : When changing linting rules, test the `packages/solidart_lint/` package examples
Applied to files:
examples/infinite_scroll/analysis_options.yaml
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/{solidart,flutter_solidart}/lib/**/*.dart : Use Signals for state, Effects for side effects, and Computed for derived values in library code
Applied to files:
examples/infinite_scroll/analysis_options.yaml
🔇 Additional comments (12)
.gitignore (1)
38-38: LGTM!Adding "windows" to the ignored platform directories is consistent with the existing pattern for other platforms.
examples/infinite_scroll/analysis_options.yaml (1)
1-4: LGTM!The analysis options configuration correctly inherits Flutter lints and follows standard conventions.
examples/infinite_scroll/.gitignore (1)
1-45: LGTM!The .gitignore file contains comprehensive and standard Flutter project ignore patterns.
examples/infinite_scroll/lib/main.dart (1)
4-19: The review comment references a non-existent file that cannot be verified.The
examples/infinite_scrolldirectory and the fileexamples/infinite_scroll/lib/main.dartdo not exist in the repository. The repository contains only four examples:counter,github_search,todos, andtoggle_theme. The code snippet shown in the review (containingMyAppclass withPostsPagewidget) does not appear in any existing example file in the codebase.This review comment cannot be acted upon as written because the file being reviewed does not exist.
Likely an incorrect or invalid review comment.
examples/infinite_scroll/pubspec.yaml (3)
10-10: Based on my verification, I've discovered a critical issue with this review comment:The file
examples/infinite_scroll/pubspec.yamldoes not exist in the repository.The
examples/directory contains only four subdirectories:
- counter
- github_search
- todos
- toggle_theme
There is no
infinite_scrollexample application. A search for any actual usage of thediscopackage in Dart code returns no results—the search merely found corrupted/garbled data in configuration files (markdownlint results and CodeRabbit config).Since the file being reviewed does not exist in the codebase, the review comment cannot be verified or acted upon.
Likely an incorrect or invalid review comment.
7-7: SDK constraint^3.10.1is valid and current.Dart 3.10.1 is a stable patch release published on November 19–21, 2025, and is a valid, current version. The caret constraint syntax is correct and allows versions from 3.10.1 up to (but not including) 4.0.0.
13-14: Dependencies are current and secure—no issues found.The specified versions are the latest available on pub.dev as of November 2025:
flutter_solidart: ^2.7.1— published Nov 7, 2025; no known vulnerabilitieshttp: ^1.6.0— published Nov 11, 2025; no known vulnerabilitiesNo action required.
examples/infinite_scroll/.metadata (1)
7-8: The Flutter SDK revision is current and properly configured.The revision
19074d12f7eaf6a8180cd4036a430c1d76de904ecorresponds to Flutter version 3.38.3, released on November 20, 2025. This is a current, supported version on the stable channel and is newer than the previously documented 3.38.1. No updates are required.examples/infinite_scroll/lib/controllers/post_controller.dart (1)
23-33: Signals +Resourcewiring for paging looks solidKeeping
_startIndexas a separate signal, debouncing the fetcher by 300 ms, and disablingautoDisposeonpostsResourceis a good fit for infinite scroll and avoids over‑fetching while the user scrolls.examples/infinite_scroll/lib/ui/posts_page.dart (3)
40-69: Infinite‑scroll rendering logic looks correctThe
SignalBuilderintegration withpostsResource.state, the “no posts” empty state, and theListView.builderpattern with an extra bottom‑loader row when!hasReachedMaxare all consistent with solidart’s Resource usage and typical infinite‑scroll UX.
106-121:PostListItemimplementation is clean and idiomaticUsing
textTheme.bodySmallfor the id and a dense three‑lineListTilefor title/body is straightforward and should render well in a long list.
30-38: File does not exist in repository. Review is inapplicable.The file
examples/infinite_scroll/lib/ui/posts_page.dartdoes not exist in this repository. The available examples are:counter,github_search,todos, andtoggle_theme. There is noinfinite_scrollexample.The review comment references code that is not present in the codebase, making all claims and suggested fixes invalid.
Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
examples/infinite_scroll/lib/domain/post.dart (1)
11-17: Harden JSON parsing to avoidas-based runtime type errorsThe new null‑aware casts improve things over direct casts, but
as int?/as String?will still throw if the API ever returns an unexpected type (e.g.,id: "1"instead of1). For a more robust example, you can avoidasentirely and fall back safely:- factory Post.fromJson(Map<String, dynamic> json) { - return Post( - id: json['id'] as int? ?? 0, - title: json['title'] as String? ?? '', - body: json['body'] as String? ?? '', - ); - } + factory Post.fromJson(Map<String, dynamic> json) { + final id = json['id']; + final title = json['title']; + final body = json['body']; + + return Post( + id: id is int ? id : 0, + title: title is String ? title : '', + body: body is String ? body : '', + ); + }This keeps the same defaulting behavior for missing/nullable fields while also preventing runtime
TypeErrors on unexpected shapes.
🧹 Nitpick comments (1)
examples/infinite_scroll/lib/main.dart (1)
8-20: App bootstrap is correct; consider a more descriptive titleThe main entrypoint and
MaterialAppsetup look good, and the previousColorScheme.fromSeedsyntax issue is resolved. As a minor polish for the example, you might make the title reflect the sample’s purpose:- return MaterialApp( - title: 'Flutter Demo', + return MaterialApp( + title: 'Infinite Scroll Example',This makes it clearer in logs and the task switcher what this app demonstrates.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/infinite_scroll/lib/domain/post.dart(1 hunks)examples/infinite_scroll/lib/main.dart(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
examples/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Build and run example applications (counter, todos, github_search, toggle_theme) to validate real user scenarios
Files:
examples/infinite_scroll/lib/domain/post.dartexamples/infinite_scroll/lib/main.dart
🧠 Learnings (2)
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/flutter_solidart/test/flutter_solidart_test.dart : After Flutter integration changes, always run `packages/flutter_solidart/test/flutter_solidart_test.dart`
Applied to files:
examples/infinite_scroll/lib/main.dart
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/flutter_solidart/{lib,test}/**/*.dart : For Flutter Solidart changes, ensure widget tests cover `SignalBuilder`, `Provider`, and `Show` behaviors
Applied to files:
examples/infinite_scroll/lib/main.dart
🔇 Additional comments (1)
examples/infinite_scroll/lib/domain/post.dart (1)
3-9: Immutable Post model looks goodThe model is concise, immutable (
@immutable,constctor,finalfields), and suitable for use in reactive/infinite‑scroll lists.
nank1ro
left a comment
There was a problem hiding this comment.
👋 thanks for the PR, just asked some questions
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
examples/infinite_scroll/lib/controllers/post_controller.dart (2)
9-21: Consider dropping@immutableon this stateful controller.
PostControllermutates its internal state over time (posts.addAll(...),hasReachedMax.value,_startIndex.value), so the@immutableannotation can be misleading for readers and static analysis. I’d either remove@immutableor move the mutable pieces into a dedicated state object and keep this class truly immutable.
49-64: HTTP fetcher is fine; consider exposing more error detail for debugging.The fetch logic and JSON parsing look good for an example. For easier debugging, you might want to include
response.statusCode(and maybe a snippet of the body) in the thrown exception or log it before throwing, instead of always using a generic'error fetching posts'message.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
examples/infinite_scroll/lib/controllers/post_controller.dart(1 hunks)examples/infinite_scroll/lib/ui/posts_page.dart(1 hunks)examples/infinite_scroll/pubspec.yaml(1 hunks)pubspec.yaml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- examples/infinite_scroll/pubspec.yaml
- examples/infinite_scroll/lib/ui/posts_page.dart
🧰 Additional context used
📓 Path-based instructions (1)
examples/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Build and run example applications (counter, todos, github_search, toggle_theme) to validate real user scenarios
Files:
examples/infinite_scroll/lib/controllers/post_controller.dart
🧠 Learnings (2)
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/flutter_solidart/{lib,test}/**/*.dart : For Flutter Solidart changes, ensure widget tests cover `SignalBuilder`, `Provider`, and `Show` behaviors
Applied to files:
examples/infinite_scroll/lib/controllers/post_controller.dartpubspec.yaml
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to examples/** : Build and run example applications (counter, todos, github_search, toggle_theme) to validate real user scenarios
Applied to files:
pubspec.yaml
🔇 Additional comments (3)
pubspec.yaml (1)
7-19: Workspace entry forexamples/infinite_scrolllooks correct.The new workspace member is consistent with the other example entries; no changes needed. As a follow‑up, please make sure the
examples/infinite_scrollapp builds and runs on your target platforms alongside the other examples. Based on learnings, this repo expects example apps to be exercised end‑to‑end.examples/infinite_scroll/lib/controllers/post_controller.dart (2)
23-41: Paging logic in_getPostsis straightforward and matches the API.The combination of
_startIndex,_postLimit, andhasReachedMaxlooks correct for jsonplaceholder-style pagination: you treat an empty page as the terminal condition and append new posts intoposts, which is what an infinite list needs. No changes required here.
43-47: Verify how the first page load is triggered with_startIndexandloadMore().
loadMoresets_startIndex.value = posts.length. Whenpostsis empty, this writes0into a signal that already holds0. SolidartSignals can skip notifying listeners when the new value equals the previous one by default, which may mean theResource’ssourcedoesn’t see a change in that scenario.If your initial page load path relies on calling
loadMore()whilepostsis empty (rather than on theResource’s initial fetch), consider:
- Triggering the first load via
postsResource.refresh(), or- Initializing
_startIndexwith a sentinel (e.g.-1) and mapping that to0inside_getPosts.
| final _startIndex = Signal<int>(0); | ||
| late final postsResource = Resource( | ||
| _getPosts, | ||
| autoDispose: false, |
There was a problem hiding this comment.
why do you need autoDispose false?
The default value (true) is your friend.
If things are composed correctly, you should be fine with the default.
There was a problem hiding this comment.
I'm testing with Resource to see if there are any side effects. I'm aware that the default value is true, and I need to check what impact setting it to false would have. I forgot to remove this line, but since it's a small demo project, it doesn't have any impact right now. Thanks for pointing it out.
There was a problem hiding this comment.
It auto disposes when there are no longer listeners. But I don't think it can happen in this demo.
And even if it happens, it should be safe because the widget tree that contains ProviderScope should be removed and recreated (e.g. when the page is popped and pushed again).
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
examples/infinite_scroll/lib/controllers/post_controller.dart (1)
48-63: Consider demonstrating more comprehensive error handling.The current implementation only checks for status code 200 and throws a generic exception otherwise. For a more robust example, consider handling:
- Network errors (timeouts, no connection)
- Different HTTP error codes (404, 500, etc.) with specific messages
- Request timeouts
Example enhancement:
Future<List<Post>> _fetchPosts({required int startIndex}) async { try { final response = await _httpClient .get( Uri.https('jsonplaceholder.typicode.com', '/posts', <String, String>{ '_start': '$startIndex', '_limit': '$_postLimit', }), ) .timeout(const Duration(seconds: 10)); if (response.statusCode == 200) { final body = json.decode(response.body) as List; return List<Post>.from(body.map((x) => Post.fromJson(x))); } throw Exception('Failed to fetch posts: ${response.statusCode}'); } catch (e) { throw Exception('Error fetching posts: $e'); } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/infinite_scroll/lib/controllers/post_controller.dart(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
examples/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Build and run example applications (counter, todos, github_search, toggle_theme) to validate real user scenarios
Files:
examples/infinite_scroll/lib/controllers/post_controller.dart
🔇 Additional comments (4)
examples/infinite_scroll/lib/controllers/post_controller.dart (4)
17-17: LGTM! Good constructor pattern for testability.The optional
httpClientparameter enables dependency injection, making the controller easy to test with mock clients while defaulting to a real client in production.
30-40: LGTM! Pagination logic correctly accumulates posts.The method properly:
- Detects end of data with empty responses
- Accumulates posts in the internal list
- Returns the complete list for the Resource state
Any exceptions from
_fetchPostswill be caught by the Resource error handling.
42-46: LGTM! Load trigger is properly guarded.The guards correctly prevent redundant fetches when:
- The end of data has been reached (
hasReachedMax)- A fetch is already in progress (
isLoading)The Resource's 300ms debounce provides additional protection against rapid calls.
24-28: This review targets a non-existent file.The file
examples/infinite_scroll/lib/controllers/post_controller.dartdoes not exist in the repository. The available examples are: counter, github_search, todos, and toggle_theme. While the Resource API usage pattern shown (withdebounceDelayandsourceparameters) is valid per the flutter_solidart documentation, this review cannot be applied.Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
examples/infinite_scroll/lib/controllers/post_controller.dart (3)
8-18: Add adisposepath to clean uphttp.Clientand reactive primitives.The controller currently never disposes
_httpClient(or any signals/resources you might later add), so the client can live for the lifetime of the app even if this provider is scoped to a page. In line with the existing Disco/Solidart examples, consider:
- Adding a
void dispose()method onPostControllerthat calls_httpClient.close()(and disposes anySignal/Resourceif needed).- Wiring the provider with a
disposecallback where you instantiate it (e.g.Provider<PostController>((_) => PostController(), dispose: (c) => c.dispose())).This keeps the example aligned with the rest of the repo and avoids subtle resource leaks in more complex usages.
20-38: Paging logic looks solid; consider explicit handling for “same index” retries.The combination of
_startIndexassource,_posts.lengthas the next offset, andhasReachedMaxgating is clean and matches typical infinite-scroll behavior.One minor edge case to keep in mind: if a load fails and
_posts.lengthdoesn’t change,loadMore()will try to set_startIndexback to the same value. Whether that actually re-triggers theResourcedepends on howSignaltreats setting an identical value. If you want deterministic retry semantics, you could:
- Either explicitly bump
_startIndexby_postLimitfor “load next page” use-cases, or- Provide a separate “retry” path that calls the appropriate
ResourceAPI (e.g.,refetch/reload) instead of relying on a same-value write.This is optional, but may make error/retry flows more predictable.
47-61: Enrich the error thrown on non-200 responses for easier debugging.Right now any non-200 just throws
Exception('error fetching posts'), which makes it harder to understand what went wrong when debugging the example.Consider including at least the
statusCode(and optionally a truncated body) in the exception:- throw Exception('error fetching posts'); + throw Exception( + 'Error fetching posts (status: ${response.statusCode})', + );This keeps the sample simple while giving much better signal when the API misbehaves.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/infinite_scroll/lib/controllers/post_controller.dart(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
examples/**
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Build and run example applications (counter, todos, github_search, toggle_theme) to validate real user scenarios
Files:
examples/infinite_scroll/lib/controllers/post_controller.dart
🧠 Learnings (5)
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/flutter_solidart/{lib,test}/**/*.dart : For Flutter Solidart changes, ensure widget tests cover `SignalBuilder`, `Provider`, and `Show` behaviors
Applied to files:
examples/infinite_scroll/lib/controllers/post_controller.dart
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/{solidart,flutter_solidart}/lib/**/*.dart : Use Signals for state, Effects for side effects, and Computed for derived values in library code
Applied to files:
examples/infinite_scroll/lib/controllers/post_controller.dart
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/solidart/test/solidart_test.dart : After Signal changes, always run `packages/solidart/test/solidart_test.dart`
Applied to files:
examples/infinite_scroll/lib/controllers/post_controller.dart
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/solidart/test/**/*.dart : Write unit tests covering Signal operations and state transitions
Applied to files:
examples/infinite_scroll/lib/controllers/post_controller.dart
📚 Learning: 2025-09-10T15:36:53.390Z
Learnt from: CR
Repo: nank1ro/solidart PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-10T15:36:53.390Z
Learning: Applies to packages/{solidart,flutter_solidart}/lib/**/*.dart : Ensure proper memory management: Signals auto-dispose in Flutter contexts; manually dispose in pure Dart code
Applied to files:
examples/infinite_scroll/lib/controllers/post_controller.dart
🔇 Additional comments (2)
examples/infinite_scroll/lib/controllers/post_controller.dart (2)
40-44:loadMoreguard and offset update look correct.The
hasReachedMaxandisLoadingchecks combined with_posts.lengthas the next offset give a clean, race-resistant infinite scroll trigger. No changes needed here.
1-62: Please run theinfinite_scrollexample end-to-end to validate UX.Given this lives under
examples/, it’s worth running the app (scrolling through untilhasReachedMaxis hit and simulating flaky network conditions if possible) to confirm that:
- Only one page loads at a time.
- The list stops at the end without redundant requests.
- Error states surface sensibly in the UI.
You can do this via a targeted
flutter runon theinfinite_scrollexample from the repo root.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #163 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 18
Lines 931 931
=========================================
Hits 931 931 🚀 New features to boost your workflow:
|
|
@all-contributors please add @hareshgediya for code |
|
I've put up a pull request to add @hareshgediya! 🎉 |
This PR introduces a new infinite scroll example demonstrating how to use the solidart library to implement a smooth, reactive infinite list loading experience.
Summary by CodeRabbit
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.