isAppShown property

bool Function(AppLifecycleState state)? isAppShown
final

Which AppLifecycleStates count as "the user is looking at the app", and so as focused for refetchOnWindowFocus.

QueryClientProvider.create(
  create: QueryClient.new,
  // Only a fully resumed app counts, on every platform:
  isAppShown: (state) => state == AppLifecycleState.resumed,
  child: const MyApp(),
);

null uses the built-in mapping the class doc describes, which reads AppLifecycleState.inactive differently per platform. Override it for a platform whose conventions differ, or to switch focus refetching to a signal of your own. The mapping given on the latest build is the one in force: it is applied to the state the app is in when it changes, and decides every transition after.

Implementation

final bool Function(AppLifecycleState state)? isAppShown;