-
Gildásio Filho authored
The documentation for using `findChildIndexCallback` recommends using `indexOf`, but that causes [this line](https://github.com/flutter/flutter/blob/05259ca938c9ea27aa551048b690d5a06371a6c0/packages/flutter/lib/src/rendering/sliver_multi_box_adaptor.dart#L259) to throw in debug mode, and when using `SliverList`, it breaks the render. This PR changes the usage to check if the index is not negative before using it, and changes to return `null` instead if the child wasn't able to be found. There's the related issue #107123, but this doesn't actually fix it. ----- This PR has been updated to add the snippets that were used in the `findChildIndexCallback` comment as examples with proper tests, as well as updating the comment to reference the new examples.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
cupertino | ||
gestures/tap_and_drag | ||
material | ||
painting | ||
rendering | ||
sample_templates | ||
services | ||
ui/text | ||
widgets | ||
flutter_test_config.dart | ||
goldens_io.dart | ||
goldens_web.dart |