From 0cc7ae194ba9aeadd0739e83bea3b91ac18615cd Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Fri, 10 Feb 2023 22:15:31 +0600 Subject: [PATCH] refactor: directory restructure revamp --- .../lib/src/collections/default_configs.dart | 15 +++++++++++++++ packages/fl_query/lib/src/constants.dart | 15 --------------- packages/fl_query/lib/src/{ => core}/cache.dart | 0 packages/fl_query/lib/src/{ => core}/client.dart | 0 .../fl_query/lib/src/{ => core}/provider.dart | 2 +- packages/fl_query/lib/src/{ => core}/query.dart | 8 ++++---- packages/fl_query/lib/src/{ => core}/retryer.dart | 0 .../fl_query/lib/src/widgets/query_builder.dart | 0 8 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 packages/fl_query/lib/src/collections/default_configs.dart delete mode 100644 packages/fl_query/lib/src/constants.dart rename packages/fl_query/lib/src/{ => core}/cache.dart (100%) rename packages/fl_query/lib/src/{ => core}/client.dart (100%) rename packages/fl_query/lib/src/{ => core}/provider.dart (86%) rename packages/fl_query/lib/src/{ => core}/query.dart (93%) rename packages/fl_query/lib/src/{ => core}/retryer.dart (100%) create mode 100644 packages/fl_query/lib/src/widgets/query_builder.dart diff --git a/packages/fl_query/lib/src/collections/default_configs.dart b/packages/fl_query/lib/src/collections/default_configs.dart new file mode 100644 index 0000000..0e5a4a6 --- /dev/null +++ b/packages/fl_query/lib/src/collections/default_configs.dart @@ -0,0 +1,15 @@ +import 'package:fl_query/src/core/query.dart'; +import 'package:fl_query/src/core/retryer.dart'; + +abstract class DefaultConstants { + static const RetryConfig retryConfig = RetryConfig( + maxRetries: 3, + retryDelay: Duration(seconds: 1), + timeout: Duration(seconds: 5), + ); + + static const RefreshConfig refreshConfig = RefreshConfig( + staleDuration: Duration(seconds: 10), + refreshInterval: Duration(seconds: 5), + ); +} diff --git a/packages/fl_query/lib/src/constants.dart b/packages/fl_query/lib/src/constants.dart deleted file mode 100644 index 5c37307..0000000 --- a/packages/fl_query/lib/src/constants.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:fl_query/src/query.dart'; -import 'package:fl_query/src/retryer.dart'; - -abstract class Constants { - static const RetryConfig defaultRetryConfig = RetryConfig( - maxRetries: 3, - retryDelay: Duration(seconds: 1), - timeout: Duration(seconds: 5), - ); - - static const RefreshConfig defaultRefreshConfig = RefreshConfig( - staleDuration: Duration(seconds: 10), - refreshInterval: Duration(seconds: 5), - ); -} diff --git a/packages/fl_query/lib/src/cache.dart b/packages/fl_query/lib/src/core/cache.dart similarity index 100% rename from packages/fl_query/lib/src/cache.dart rename to packages/fl_query/lib/src/core/cache.dart diff --git a/packages/fl_query/lib/src/client.dart b/packages/fl_query/lib/src/core/client.dart similarity index 100% rename from packages/fl_query/lib/src/client.dart rename to packages/fl_query/lib/src/core/client.dart diff --git a/packages/fl_query/lib/src/provider.dart b/packages/fl_query/lib/src/core/provider.dart similarity index 86% rename from packages/fl_query/lib/src/provider.dart rename to packages/fl_query/lib/src/core/provider.dart index c3ff5cf..3761a2b 100644 --- a/packages/fl_query/lib/src/provider.dart +++ b/packages/fl_query/lib/src/core/provider.dart @@ -1,4 +1,4 @@ -import 'package:fl_query/src/client.dart'; +import 'package:fl_query/src/core/client.dart'; import 'package:flutter/material.dart'; class QueryClientProvider extends InheritedWidget { diff --git a/packages/fl_query/lib/src/query.dart b/packages/fl_query/lib/src/core/query.dart similarity index 93% rename from packages/fl_query/lib/src/query.dart rename to packages/fl_query/lib/src/core/query.dart index ee23757..11549e5 100644 --- a/packages/fl_query/lib/src/query.dart +++ b/packages/fl_query/lib/src/core/query.dart @@ -1,7 +1,7 @@ import 'dart:async'; -import 'package:fl_query/src/constants.dart'; -import 'package:fl_query/src/retryer.dart'; +import 'package:fl_query/src/collections/default_configs.dart'; +import 'package:fl_query/src/core/retryer.dart'; import 'package:flutter/cupertino.dart'; import 'package:hive_flutter/adapters.dart'; import 'package:mutex/mutex.dart'; @@ -76,8 +76,8 @@ class Query extends StateNotifier> this.key, QueryFn queryFn, { this.initial, - this.retryConfig = Constants.defaultRetryConfig, - this.refreshConfig = Constants.defaultRefreshConfig, + this.retryConfig = DefaultConstants.retryConfig, + this.refreshConfig = DefaultConstants.refreshConfig, this.jsonConfig, }) : _box = Hive.lazyBox("cache"), super(QueryState( diff --git a/packages/fl_query/lib/src/retryer.dart b/packages/fl_query/lib/src/core/retryer.dart similarity index 100% rename from packages/fl_query/lib/src/retryer.dart rename to packages/fl_query/lib/src/core/retryer.dart diff --git a/packages/fl_query/lib/src/widgets/query_builder.dart b/packages/fl_query/lib/src/widgets/query_builder.dart new file mode 100644 index 0000000..e69de29