refactor: make args required and add fetchQueryJob and fetchInfiniteQueryJob

This commit is contained in:
Kingkor Roy Tirtho
2023-10-20 10:01:36 +06:00
parent 6c65fa2017
commit 81a1fc1515
12 changed files with 52 additions and 20 deletions
@@ -5,9 +5,9 @@ import 'package:flutter/material.dart';
InfiniteQuery<DataType, ErrorType, PageType>
useInfiniteQueryJob<DataType, ErrorType, PageType, ArgsType>({
required InfiniteQueryJob<DataType, ErrorType, PageType, ArgsType> job,
required ArgsType args,
ValueChanged<PageEvent<DataType, PageType>>? onData,
ValueChanged<PageEvent<ErrorType, PageType>>? onError,
ArgsType? args,
List<Object?>? keys,
}) {
return useInfiniteQuery<DataType, ErrorType, PageType>(
@@ -9,7 +9,7 @@ Mutation<DataType, ErrorType, VariablesType>
MutationOnDataFn<DataType, RecoveryType>? onData,
MutationOnErrorFn<ErrorType, RecoveryType>? onError,
MutationOnMutationFn<VariablesType, RecoveryType>? onMutate,
ArgsType? args,
required ArgsType args,
List<Object?>? keys,
}) {
return useMutation(
@@ -6,7 +6,7 @@ Query<DataType, ErrorType> useQueryJob<DataType, ErrorType, ArgsType>({
required QueryJob<DataType, ErrorType, ArgsType> job,
ValueChanged<DataType>? onData,
ValueChanged<ErrorType>? onError,
ArgsType? args,
required ArgsType args,
}) {
return useQuery<DataType, ErrorType>(
job.queryKey,
@@ -26,7 +26,7 @@ InfiniteQuery<DataType, ErrorType, PageType>
final query = client.createInfiniteQuery<DataType, ErrorType, PageType>(
queryKey,
queryFn,
initialParam: initialPage,
initialPage: initialPage,
nextPage: nextPage,
jsonConfig: jsonConfig,
refreshConfig: refreshConfig,