From 5101154913e60240f55b68e8f48368dfcbc62879 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 11:43:22 +0200 Subject: [PATCH 1/7] build(pubspec): add flutter as dependency --- pubspec.lock | 10 ++++++++++ pubspec.yaml | 2 ++ 2 files changed, 12 insertions(+) diff --git a/pubspec.lock b/pubspec.lock index 825e49c..fdb2d71 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -129,6 +129,11 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" frontend_server_client: dependency: transitive description: @@ -393,6 +398,11 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" source_map_stack_trace: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3ccfba9..c2c1c91 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,4 +12,6 @@ dev_dependencies: very_good_analysis: ^5.1.0 dependencies: + flutter: + sdk: flutter riverpod: ^2.0.0 From 5d36334cdf6b2360dac887dd6cdc512850443351 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 11:52:19 +0200 Subject: [PATCH 2/7] build(pubspec): use flutter test --- pubspec.lock | 230 +++++--------------- pubspec.yaml | 3 +- test/src/auto_refresh_extension_test.dart | 2 +- test/src/cache_data_for_extension_test.dart | 2 +- test/src/cache_for_extension_test.dart | 2 +- test/src/debounce_extension_test.dart | 2 +- 6 files changed, 60 insertions(+), 181 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index fdb2d71..9371cad 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,22 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - sha256: "36a321c3d2cbe01cbcb3540a87b8843846e0206df3e691fa7b23e19e78de6d49" - url: "https://pub.dev" - source: hosted - version: "65.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - sha256: dfe03b90ec022450e22513b5e5ca1f01c0c01de9c3fba2f7fd233cb57a6b9a07 - url: "https://pub.dev" - source: hosted - version: "6.3.0" ansi_styles: dependency: transitive description: @@ -49,6 +33,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" charcode: dependency: transitive description: @@ -97,30 +89,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.0+1" - convert: - dependency: transitive - description: - name: convert - sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" - url: "https://pub.dev" - source: hosted - version: "3.1.1" - coverage: - dependency: transitive - description: - name: coverage - sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" - url: "https://pub.dev" - source: hosted - version: "1.8.0" - crypto: + fake_async: dependency: transitive description: - name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "1.3.1" file: dependency: transitive description: @@ -134,14 +110,11 @@ packages: description: flutter source: sdk version: "0.0.0" - frontend_server_client: - dependency: transitive - description: - name: frontend_server_client - sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" - url: "https://pub.dev" - source: hosted - version: "3.2.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" glob: dependency: transitive description: @@ -166,14 +139,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" - url: "https://pub.dev" - source: hosted - version: "3.2.1" http_parser: dependency: transitive description: @@ -198,14 +163,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" json_annotation: dependency: transitive description: @@ -214,14 +171,30 @@ packages: url: "https://pub.dev" source: hosted version: "4.9.0" - logging: + leak_tracker: dependency: transitive description: - name: logging - sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" matcher: dependency: transitive description: @@ -230,6 +203,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" melos: dependency: "direct dev" description: @@ -246,14 +227,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.0" - mime: - dependency: transitive - description: - name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e - url: "https://pub.dev" - source: hosted - version: "1.0.4" mocktail: dependency: "direct dev" description: @@ -270,22 +243,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.0" - node_preamble: - dependency: transitive - description: - name: node_preamble - sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" - url: "https://pub.dev" - source: hosted - version: "2.0.2" - package_config: - dependency: transitive - description: - name: package_config - sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" - url: "https://pub.dev" - source: hosted - version: "2.1.0" path: dependency: transitive description: @@ -366,59 +323,11 @@ packages: url: "https://pub.dev" source: hosted version: "2.4.6" - shelf: - dependency: transitive - description: - name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 - url: "https://pub.dev" - source: hosted - version: "1.4.1" - shelf_packages_handler: - dependency: transitive - description: - name: shelf_packages_handler - sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" - url: "https://pub.dev" - source: hosted - version: "3.0.2" - shelf_static: - dependency: transitive - description: - name: shelf_static - sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e - url: "https://pub.dev" - source: hosted - version: "1.1.2" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" - url: "https://pub.dev" - source: hosted - version: "1.0.4" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" - source_map_stack_trace: - dependency: transitive - description: - name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" - url: "https://pub.dev" - source: hosted - version: "2.1.1" - source_maps: - dependency: transitive - description: - name: source_maps - sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" - url: "https://pub.dev" - source: hosted - version: "0.10.12" source_span: dependency: transitive description: @@ -467,14 +376,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.1" - test: - dependency: "direct dev" - description: - name: test - sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073" - url: "https://pub.dev" - source: hosted - version: "1.25.2" test_api: dependency: transitive description: @@ -483,14 +384,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.0" - test_core: - dependency: transitive - description: - name: test_core - sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4" - url: "https://pub.dev" - source: hosted - version: "0.6.0" typed_data: dependency: transitive description: @@ -507,6 +400,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" very_good_analysis: dependency: "direct dev" description: @@ -523,14 +424,6 @@ packages: url: "https://pub.dev" source: hosted version: "14.2.1" - watcher: - dependency: transitive - description: - name: watcher - sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" - url: "https://pub.dev" - source: hosted - version: "1.1.0" web: dependency: transitive description: @@ -539,22 +432,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.1" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b - url: "https://pub.dev" - source: hosted - version: "2.4.0" - webkit_inspection_protocol: - dependency: transitive - description: - name: webkit_inspection_protocol - sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" - url: "https://pub.dev" - source: hosted - version: "1.2.1" yaml: dependency: transitive description: @@ -573,3 +450,4 @@ packages: version: "2.2.1" sdks: dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/pubspec.yaml b/pubspec.yaml index c2c1c91..565be89 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,9 +6,10 @@ environment: sdk: ">=3.0.0 <4.0.0" dev_dependencies: + flutter_test: + sdk: flutter melos: ^6.1.0 mocktail: ^1.0.0 - test: ^1.19.2 very_good_analysis: ^5.1.0 dependencies: diff --git a/test/src/auto_refresh_extension_test.dart b/test/src/auto_refresh_extension_test.dart index ef3e268..90e005d 100644 --- a/test/src/auto_refresh_extension_test.dart +++ b/test/src/auto_refresh_extension_test.dart @@ -1,6 +1,6 @@ +import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; import 'package:riverpods_community_extensions/src/auto_refresh_extension.dart'; -import 'package:test/test.dart'; void main() { group('auto-refresh extension', () { diff --git a/test/src/cache_data_for_extension_test.dart b/test/src/cache_data_for_extension_test.dart index ce47f85..e3e6c17 100644 --- a/test/src/cache_data_for_extension_test.dart +++ b/test/src/cache_data_for_extension_test.dart @@ -1,6 +1,6 @@ +import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; import 'package:riverpods_community_extensions/riverpods_community_extensions.dart'; -import 'package:test/test.dart'; void main() { group('cacheDataFor extension', () { diff --git a/test/src/cache_for_extension_test.dart b/test/src/cache_for_extension_test.dart index 9b5f0bb..2100399 100644 --- a/test/src/cache_for_extension_test.dart +++ b/test/src/cache_for_extension_test.dart @@ -1,6 +1,6 @@ +import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; import 'package:riverpods_community_extensions/src/cache_for_extension.dart'; -import 'package:test/test.dart'; void main() { group('ProviderCache', () { diff --git a/test/src/debounce_extension_test.dart b/test/src/debounce_extension_test.dart index 6693b1c..413356f 100644 --- a/test/src/debounce_extension_test.dart +++ b/test/src/debounce_extension_test.dart @@ -1,6 +1,6 @@ +import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; import 'package:riverpods_community_extensions/src/debounce_extension.dart'; -import 'package:test/test.dart'; void main() { group('debounce extension', () { From 8950687d5cdb01ca23543edc0c4f443dff853076 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 11:57:21 +0200 Subject: [PATCH 3/7] feat(auto_refresh): add refreshWhenReturningToForeground --- lib/src/auto_refresh_extension.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/auto_refresh_extension.dart b/lib/src/auto_refresh_extension.dart index 32721bc..58ca434 100644 --- a/lib/src/auto_refresh_extension.dart +++ b/lib/src/auto_refresh_extension.dart @@ -1,5 +1,5 @@ import 'dart:async'; - +import 'package:flutter/widgets.dart'; import 'package:riverpod/riverpod.dart'; /// Adds auto-refresh functionality to AutoDisposeRef objects. @@ -34,4 +34,11 @@ extension AutoRefreshExtension on AutoDisposeRef { final timer = Timer(duration, invalidateSelf); onDispose(timer.cancel); } + + /// Refreshes the value each time the app returns to foreground. + /// + void refreshWhenReturningToForeground() { + final listener = AppLifecycleListener(onResume: invalidateSelf); + onDispose(listener.dispose); + } } From 8676d0512ca0785e9f05793d066b20cf3d7c5f62 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 12:00:55 +0200 Subject: [PATCH 4/7] test(auto_refresh): add tests for refreshWhenReturningToForeground extension --- test/src/auto_refresh_extension_test.dart | 58 +++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/test/src/auto_refresh_extension_test.dart b/test/src/auto_refresh_extension_test.dart index 90e005d..7bdfc70 100644 --- a/test/src/auto_refresh_extension_test.dart +++ b/test/src/auto_refresh_extension_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; import 'package:riverpods_community_extensions/src/auto_refresh_extension.dart'; @@ -72,4 +73,61 @@ void main() { expect(numberOfFetchDataCalls, 3); }); }); + + group('refreshWhenReturningToForeground', () { + var numberOfFetchDataCalls = 0; + + int fetchData() { + numberOfFetchDataCalls++; + return 42; + } + + final myProvider = Provider.autoDispose((ref) { + ref.refreshWhenReturningToForeground(); + return fetchData(); + }); + + late ProviderContainer container; + + setUp(() { + numberOfFetchDataCalls = 0; + container = ProviderContainer()..listen(myProvider, (_, __) {}); + }); + + tearDown(() { + container.dispose(); + }); + + testWidgets('can refresh when returning to foreground', (tester) async { + // The value should be fetched initially + expect(numberOfFetchDataCalls, 1); + + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive); + await tester.pumpAndSettle(); + expect(numberOfFetchDataCalls, 1); + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed); + await tester.pumpAndSettle(); + expect(numberOfFetchDataCalls, 2); + + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive); + await tester.pumpAndSettle(); + expect(numberOfFetchDataCalls, 2); + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed); + await tester.pumpAndSettle(); + expect(numberOfFetchDataCalls, 3); + }); + + testWidgets('can be properly disposed', (tester) async { + // The value should be fetched initially + expect(numberOfFetchDataCalls, 1); + + container.dispose(); + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.inactive); + await tester.pumpAndSettle(); + expect(numberOfFetchDataCalls, 1); + tester.binding.handleAppLifecycleStateChanged(AppLifecycleState.resumed); + await tester.pumpAndSettle(); + expect(numberOfFetchDataCalls, 1); + }); + }); } From 6881669e16d0c6527142c06659274f5540d107c0 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 12:05:10 +0200 Subject: [PATCH 5/7] doc(auto_refresh): fix codegen syntax --- lib/src/auto_refresh_extension.dart | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/src/auto_refresh_extension.dart b/lib/src/auto_refresh_extension.dart index 58ca434..f0188ef 100644 --- a/lib/src/auto_refresh_extension.dart +++ b/lib/src/auto_refresh_extension.dart @@ -16,7 +16,7 @@ extension AutoRefreshExtension on AutoDisposeRef { /// /// without codegen: /// ```dart - /// final myProvider = Provider((ref) { + /// final dataProvider = Provider((ref) { /// ref.autoRefresh(const Duration(seconds: 1)); /// return fetchData(); /// }); @@ -25,7 +25,7 @@ extension AutoRefreshExtension on AutoDisposeRef { /// with codegen: /// ```dart /// @riverpod - /// int myProvider(MyRef ref) { + /// int data(DataRef ref) { /// ref.autoRefresh(const Duration(seconds: 1)); /// return fetchData(); /// } @@ -37,6 +37,24 @@ extension AutoRefreshExtension on AutoDisposeRef { /// Refreshes the value each time the app returns to foreground. /// + /// Example usages: + /// without codegen: + /// ```dart + /// final dataProvider = Provider((ref) { + /// ref.refreshWhenReturningToForeground(); + /// return fetchData(); + /// }); + /// ``` + /// + /// with codegen: + /// ```dart + /// @riverpod + /// int data(DataRef ref) { + /// ref.refreshWhenReturningToForeground(); + /// return fetchData(); + /// } + /// ``` + /// void refreshWhenReturningToForeground() { final listener = AppLifecycleListener(onResume: invalidateSelf); onDispose(listener.dispose); From ff28dce81c58a90f8fef59f0c83d6db2cd1cf279 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 12:08:08 +0200 Subject: [PATCH 6/7] doc(refresh): rename extension to be more generic --- lib/riverpods_community_extensions.dart | 2 +- ...{auto_refresh_extension.dart => refresh_extension.dart} | 7 +++---- ...esh_extension_test.dart => refresh_extension_test.dart} | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) rename lib/src/{auto_refresh_extension.dart => refresh_extension.dart} (87%) rename test/src/{auto_refresh_extension_test.dart => refresh_extension_test.dart} (96%) diff --git a/lib/riverpods_community_extensions.dart b/lib/riverpods_community_extensions.dart index afa69cd..d36942d 100644 --- a/lib/riverpods_community_extensions.dart +++ b/lib/riverpods_community_extensions.dart @@ -1,7 +1,7 @@ /// Community extensions for Riverpods library riverpods_community_extensions; -export 'src/auto_refresh_extension.dart'; +export 'src/refresh_extension.dart'; export 'src/cache_data_for_extension.dart'; export 'src/cache_for_extension.dart'; export 'src/debounce_extension.dart'; diff --git a/lib/src/auto_refresh_extension.dart b/lib/src/refresh_extension.dart similarity index 87% rename from lib/src/auto_refresh_extension.dart rename to lib/src/refresh_extension.dart index f0188ef..fa13b37 100644 --- a/lib/src/auto_refresh_extension.dart +++ b/lib/src/refresh_extension.dart @@ -2,11 +2,10 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; import 'package:riverpod/riverpod.dart'; -/// Adds auto-refresh functionality to AutoDisposeRef objects. -/// allows you to refresh a value at a specified interval. +/// Adds auto-refresh functionalities to AutoDisposeRef objects. /// -/// See [autoRefresh] -extension AutoRefreshExtension on AutoDisposeRef { +/// See [autoRefresh] and [refreshWhenReturningToForeground] for more details. +extension RefreshExtension on AutoDisposeRef { /// Refreshes the value at the specified interval. /// /// This can be useful for scenarios where you want to refresh a value at a diff --git a/test/src/auto_refresh_extension_test.dart b/test/src/refresh_extension_test.dart similarity index 96% rename from test/src/auto_refresh_extension_test.dart rename to test/src/refresh_extension_test.dart index 7bdfc70..647163d 100644 --- a/test/src/auto_refresh_extension_test.dart +++ b/test/src/refresh_extension_test.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; -import 'package:riverpods_community_extensions/src/auto_refresh_extension.dart'; +import 'package:riverpods_community_extensions/src/refresh_extension.dart'; void main() { group('auto-refresh extension', () { @@ -74,7 +74,7 @@ void main() { }); }); - group('refreshWhenReturningToForeground', () { + group('refreshWhenReturningToForeground extension', () { var numberOfFetchDataCalls = 0; int fetchData() { From bed096b67f8da9faef7b8c8b365e36c764c333b2 Mon Sep 17 00:00:00 2001 From: giboin Date: Thu, 4 Jul 2024 14:41:13 +0200 Subject: [PATCH 7/7] typo(all): riverpod without s --- README.md | 10 +++++----- ...ensions.dart => riverpod_community_extensions.dart} | 6 +++--- pubspec.yaml | 4 ++-- test/src/cache_data_for_extension_test.dart | 2 +- test/src/cache_for_extension_test.dart | 2 +- test/src/debounce_extension_test.dart | 2 +- test/src/refresh_extension_test.dart | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) rename lib/{riverpods_community_extensions.dart => riverpod_community_extensions.dart} (66%) diff --git a/README.md b/README.md index 92b258b..f146bc6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Riverpods Community Extensions +# Riverpod Community Extensions [![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link] [![Powered by Mason](https://img.shields.io/endpoint?url=https%3A%2F%2Ftinyurl.com%2Fmason-badge)](https://github.com/felangel/mason) @@ -22,12 +22,12 @@ This package adds the following methods to ref types: ## Installation 💻 -**❗ In order to start using Riverpods Community Extensions you must have the [Dart SDK][dart_install_link] installed on your machine.** +**❗ In order to start using Riverpod Community Extensions you must have the [Dart SDK][dart_install_link] installed on your machine.** Install via `dart pub add`: ```sh -dart pub add riverpods_community_extensions +dart pub add riverpod_community_extensions ``` ## Usage 🎨 @@ -37,7 +37,7 @@ Simply import the package and use the provided extensions on your ref types. Example without codegen: ```dart -import 'package:riverpods_community_extensions/riverpods_community_extensions.dart'; +import 'package:riverpod_community_extensions/riverpod_community_extensions.dart'; import 'package:riverpod/riverpod.dart'; final dataProvider = FutureProvider.autoDispose((ref) async { @@ -50,7 +50,7 @@ final dataProvider = FutureProvider.autoDispose((ref) async { Example with codegen: ```dart -import 'package:riverpods_community_extensions/riverpods_community_extensions.dart'; +import 'package:riverpod_community_extensions/riverpod_community_extensions.dart'; import 'package:riverpod/riverpod.dart'; part 'data_provider.g.dart'; diff --git a/lib/riverpods_community_extensions.dart b/lib/riverpod_community_extensions.dart similarity index 66% rename from lib/riverpods_community_extensions.dart rename to lib/riverpod_community_extensions.dart index d36942d..3e2d378 100644 --- a/lib/riverpods_community_extensions.dart +++ b/lib/riverpod_community_extensions.dart @@ -1,7 +1,7 @@ -/// Community extensions for Riverpods -library riverpods_community_extensions; +/// Community extensions for riverpod +library riverpod_community_extensions; -export 'src/refresh_extension.dart'; export 'src/cache_data_for_extension.dart'; export 'src/cache_for_extension.dart'; export 'src/debounce_extension.dart'; +export 'src/refresh_extension.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 565be89..ce2579b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ -name: riverpods_community_extensions -description: Community extensions for Riverpods +name: riverpod_community_extensions +description: Community extensions for Riverpod version: 0.1.0+1 environment: diff --git a/test/src/cache_data_for_extension_test.dart b/test/src/cache_data_for_extension_test.dart index e3e6c17..5a34d12 100644 --- a/test/src/cache_data_for_extension_test.dart +++ b/test/src/cache_data_for_extension_test.dart @@ -1,6 +1,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; -import 'package:riverpods_community_extensions/riverpods_community_extensions.dart'; +import 'package:riverpod_community_extensions/riverpod_community_extensions.dart'; void main() { group('cacheDataFor extension', () { diff --git a/test/src/cache_for_extension_test.dart b/test/src/cache_for_extension_test.dart index 2100399..b9a60a7 100644 --- a/test/src/cache_for_extension_test.dart +++ b/test/src/cache_for_extension_test.dart @@ -1,6 +1,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; -import 'package:riverpods_community_extensions/src/cache_for_extension.dart'; +import 'package:riverpod_community_extensions/src/cache_for_extension.dart'; void main() { group('ProviderCache', () { diff --git a/test/src/debounce_extension_test.dart b/test/src/debounce_extension_test.dart index 413356f..962b6bb 100644 --- a/test/src/debounce_extension_test.dart +++ b/test/src/debounce_extension_test.dart @@ -1,6 +1,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; -import 'package:riverpods_community_extensions/src/debounce_extension.dart'; +import 'package:riverpod_community_extensions/src/debounce_extension.dart'; void main() { group('debounce extension', () { diff --git a/test/src/refresh_extension_test.dart b/test/src/refresh_extension_test.dart index 647163d..fd0a945 100644 --- a/test/src/refresh_extension_test.dart +++ b/test/src/refresh_extension_test.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:riverpod/riverpod.dart'; -import 'package:riverpods_community_extensions/src/refresh_extension.dart'; +import 'package:riverpod_community_extensions/src/refresh_extension.dart'; void main() { group('auto-refresh extension', () {