guard uninitialized state
This commit is contained in:
+11
-8
@@ -50,15 +50,18 @@ class FindInPageController extends _$FindInPageController {
|
|||||||
fireImmediately: true,
|
fireImmediately: true,
|
||||||
selectedTabStateProvider,
|
selectedTabStateProvider,
|
||||||
(previous, next) async {
|
(previous, next) async {
|
||||||
if (state.visible && state.lastSearchText.isNotEmpty) {
|
//Ensure state is already initialized
|
||||||
if (previous != null && next != null) {
|
if (stateOrNull != null) {
|
||||||
final loadingOrReloading =
|
if (state.visible && state.lastSearchText.isNotEmpty) {
|
||||||
previous.isLoading == true && next.isLoading == false;
|
if (previous != null && next != null) {
|
||||||
final tabSwitchWithoutResults =
|
final loadingOrReloading =
|
||||||
previous.id != next.id && !next.findResultState.hasMatches;
|
previous.isLoading == true && next.isLoading == false;
|
||||||
|
final tabSwitchWithoutResults =
|
||||||
|
previous.id != next.id && !next.findResultState.hasMatches;
|
||||||
|
|
||||||
if (loadingOrReloading || tabSwitchWithoutResults) {
|
if (loadingOrReloading || tabSwitchWithoutResults) {
|
||||||
await findAll(text: state.lastSearchText!);
|
await findAll(text: state.lastSearchText!);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ part of 'find_in_page.dart';
|
|||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
String _$findInPageControllerHash() =>
|
String _$findInPageControllerHash() =>
|
||||||
r'63a2fbf4f75be59d341501c58512792de82fdb3d';
|
r'ab421be931406325bf6b22dd9f545117ea426665';
|
||||||
|
|
||||||
/// See also [FindInPageController].
|
/// See also [FindInPageController].
|
||||||
@ProviderFor(FindInPageController)
|
@ProviderFor(FindInPageController)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class SelectedContainer extends _$SelectedContainer {
|
|||||||
fireImmediately: true,
|
fireImmediately: true,
|
||||||
containersWithCountProvider,
|
containersWithCountProvider,
|
||||||
(previous, next) {
|
(previous, next) {
|
||||||
if (state != null && next.valueOrNull != null) {
|
if (stateOrNull != null && next.valueOrNull != null) {
|
||||||
if (!next.value!.any((container) => container.id == state)) {
|
if (!next.value!.any((container) => container.id == state)) {
|
||||||
clearContainer();
|
clearContainer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ final selectedContainerDataProvider =
|
|||||||
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
@Deprecated('Will be removed in 3.0. Use Ref instead')
|
||||||
// ignore: unused_element
|
// ignore: unused_element
|
||||||
typedef SelectedContainerDataRef = AutoDisposeStreamProviderRef<ContainerData?>;
|
typedef SelectedContainerDataRef = AutoDisposeStreamProviderRef<ContainerData?>;
|
||||||
String _$selectedContainerHash() => r'075190a8a58cc6de8ce554b0a6ed54809832fdb0';
|
String _$selectedContainerHash() => r'736a60b8f19273d3bdc25d1717e3a613384e59a6';
|
||||||
|
|
||||||
/// See also [SelectedContainer].
|
/// See also [SelectedContainer].
|
||||||
@ProviderFor(SelectedContainer)
|
@ProviderFor(SelectedContainer)
|
||||||
|
|||||||
Reference in New Issue
Block a user