Skip to content

QueryState

QueryState describes the current status of your data. It is passed to the builder function in QueryBuilder.

PropertyTypeDescription
statusQueryStatusHigh-level status: idle, loading, success, error.
dataT?The successfully fetched data.
errorObject?Variable containing the error if the request failed.
dataUpdatedAtDateTime?Timestamp of the last successful fetch.
errorUpdatedAtDateTime?Timestamp of the last error.

Fasq provides convenient getters to make checks easier:

  • isLoading: True if the initial fetch is in progress (no data yet).
  • isFetching: True if any network request is outgoing (including background refreshes).
  • isSuccess: True if the status is success.
  • isError: True if the status is error.

Understanding the difference is key for good UX.

  • isLoading: Show a full-screen spinner (loading for the first time).
  • isFetching: Show a small linear indicator at the top (refreshing stale data).
if (state.isLoading) {
return FullScreenSpinner();
}
return Stack(
children: [
if (state.isFetching) TopProgressBar(),
MyDataList(data: state.data),
],
);