Skip to content

Commit

Permalink
prepare for v3.1.0 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 authored Oct 12, 2023
1 parent 7068ee6 commit 95642a7
Show file tree
Hide file tree
Showing 15 changed files with 387 additions and 175 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ '2.8.1', '2.10.5' ]
version: [ '3.0.0', '3.7.0' ]
defaults:
run:
working-directory: ./example
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ '2.8.1', '2.10.5' ]
version: [ '3.0.0', '3.7.0' ]
steps:
- uses: actions/checkout@v4

Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 3.1.0 - TODO

- Update dependencies
- `shared_preferences` to `^2.0.18`.
- `rx_storage` to `^2.1.0`

- Change `Flutter` constraint to `'>=3.0.0'`.

- Change `Dart SDK` constraint to `'>=2.17.0 <4.0.0'`.

- Deprecate all `executeUpdate...` extension methods, use `update...` instead.

## 3.0.0 - Jun 3, 2022

- Update dependencies
Expand Down
4 changes: 2 additions & 2 deletions example/lib/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extension DialogExtensions on BuildContext {
}

try {
await rxPrefs.executeUpdateStringList(key, (currentList) {
await rxPrefs.updateStringList(key, (currentList) {
final list = currentList ?? const <String>[];
if (list.contains(string)) {
throw StateError('Duplicated $string!');
Expand Down Expand Up @@ -77,7 +77,7 @@ extension DialogExtensions on BuildContext {
}

try {
await rxPrefs.executeUpdateStringList(
await rxPrefs.updateStringList(
key,
(currentList) => [
for (final s in (currentList ?? const <String>[]))
Expand Down
2 changes: 1 addition & 1 deletion example/lib/snippet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ void main() async {
);

// Or read-modify-write style.
await rxPrefs.executeUpdateStringList(
await rxPrefs.updateStringList(
idsKey, (currentIds) => [...?currentIds, 'new id']);
}
90 changes: 45 additions & 45 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: async
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.10.0"
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.3.0"
clock:
dependency: transitive
description:
Expand All @@ -45,10 +45,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.17.2"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -128,14 +128,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
js:
dependency: transitive
description:
name: js
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
url: "https://pub.dev"
source: hosted
version: "0.6.5"
lints:
dependency: transitive
description:
Expand All @@ -148,34 +140,34 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
url: "https://pub.dev"
source: hosted
version: "0.12.13"
version: "0.12.16"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
url: "https://pub.dev"
source: hosted
version: "0.2.0"
version: "0.5.0"
meta:
dependency: transitive
description:
name: meta
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
url: "https://pub.dev"
source: hosted
version: "1.8.0"
version: "1.9.1"
path:
dependency: transitive
description:
name: path
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
url: "https://pub.dev"
source: hosted
version: "1.8.2"
version: "1.8.3"
path_provider_linux:
dependency: transitive
description:
Expand Down Expand Up @@ -230,15 +222,15 @@ packages:
path: ".."
relative: true
source: path
version: "3.0.0"
version: "3.1.0"
rx_storage:
dependency: transitive
description:
name: rx_storage
sha256: bbf4ab990d56edcccbccfca2edfa7935076f00cb07770f37f6de075e44b6c048
sha256: "918d931ea5e285867f80526d6b64177c47e9636554fb4b38ec9c88e771aaaad7"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "2.1.0"
rxdart:
dependency: transitive
description:
Expand All @@ -259,58 +251,58 @@ packages:
dependency: transitive
description:
name: shared_preferences
sha256: "5949029e70abe87f75cfe59d17bf5c397619c4b74a099b10116baeb34786fad9"
sha256: b7f41bad7e521d205998772545de63ff4e6c97714775902c199353f8bf1511ac
url: "https://pub.dev"
source: hosted
version: "2.0.17"
version: "2.2.1"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "955e9736a12ba776bdd261cf030232b30eadfcd9c79b32a3250dd4a494e8c8f7"
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
url: "https://pub.dev"
source: hosted
version: "2.0.15"
version: "2.2.1"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "1ffa239043ab8baf881ec3094a3c767af9d10399b2839020b9e4d44c0bb23951"
sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.3.4"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: f8ea038aa6da37090093974ebdcf4397010605fd2ff65c37a66f9d28394cb874
sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.3.1"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: da9431745ede5ece47bc26d5d73a9d3c6936ef6945c101a5aca46f62e52c1cf3
sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.3.1"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: a4b5bc37fe1b368bbc81f953197d55e12f49d0296e7e412dfe2d2d77d6929958
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
url: "https://pub.dev"
source: hosted
version: "2.0.4"
version: "2.2.1"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "5eaf05ae77658d3521d0e993ede1af962d4b326cd2153d312df716dc250f00c9"
sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.3.1"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -320,10 +312,10 @@ packages:
dependency: transitive
description:
name: source_span
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -360,10 +352,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
url: "https://pub.dev"
source: hosted
version: "0.4.16"
version: "0.6.0"
vector_math:
dependency: transitive
description:
Expand All @@ -372,6 +364,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
web:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
win32:
dependency: transitive
description:
Expand All @@ -389,5 +389,5 @@ packages:
source: hosted
version: "0.2.0+3"
sdks:
dart: ">=2.18.0 <4.0.0"
flutter: ">=3.0.0"
dart: ">=3.1.0-185.0.dev <4.0.0"
flutter: ">=3.7.0"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: 3.0.0+1
publish_to: none

environment:
sdk: '>=2.14.0 <3.0.0'
flutter: '>=2.8.0'
sdk: '>=2.17.0 <4.0.0'
flutter: '>=3.0.0'

dependencies:
flutter:
Expand Down
19 changes: 9 additions & 10 deletions lib/src/impl/shared_preferences_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SharedPreferencesAdapter implements SharedPreferencesLike {

@override
Future<void> clear([void _]) =>
_prefs.clear().throwsIfNotSuccess('Cannot clear');
_prefs.clear().throwsIfUnsuccessful('Cannot clear');

@override
Future<bool> containsKey(String key, [void _]) =>
Expand All @@ -41,7 +41,7 @@ class SharedPreferencesAdapter implements SharedPreferencesLike {

@override
Future<void> remove(String key, [void _]) =>
_prefs.remove(key).throwsIfNotSuccess('Cannot remove key=$key');
_prefs.remove(key).throwsIfUnsuccessful('Cannot remove key=$key');

@override
Future<T?> read<T extends Object>(String key, Decoder<T?> decoder,
Expand Down Expand Up @@ -80,25 +80,24 @@ class SharedPreferencesAdapter implements SharedPreferencesLike {
return remove(key);
}
if (encoded is double) {
return _prefs.setDouble(key, encoded).throwsIfNotSuccess(
return _prefs.setDouble(key, encoded).throwsIfUnsuccessful(
'Cannot set double value: key=$key, value=$value');
}
if (encoded is int) {
return _prefs
.setInt(key, encoded)
.throwsIfNotSuccess('Cannot set int value: key=$key, value=$value');
.throwsIfUnsuccessful('Cannot set int value: key=$key, value=$value');
}
if (encoded is bool) {
return _prefs
.setBool(key, encoded)
.throwsIfNotSuccess('Cannot set bool value: key=$key, value=$value');
return _prefs.setBool(key, encoded).throwsIfUnsuccessful(
'Cannot set bool value: key=$key, value=$value');
}
if (encoded is String) {
return _prefs.setString(key, encoded).throwsIfNotSuccess(
return _prefs.setString(key, encoded).throwsIfUnsuccessful(
'Cannot set String value: key=$key, value=$value');
}
if (encoded is List<String>) {
return _prefs.setStringList(key, encoded).throwsIfNotSuccess(
return _prefs.setStringList(key, encoded).throwsIfUnsuccessful(
'Cannot set List<String> value: key=$key, value=$value');
}

Expand All @@ -113,7 +112,7 @@ class SharedPreferencesAdapter implements SharedPreferencesLike {
}

extension _ThrowsIfNotSuccess on Future<bool> {
Future<void> throwsIfNotSuccess(String message) {
Future<void> throwsIfUnsuccessful(String message) {
return then((isSuccessful) {
if (!isSuccessful) {
throw PlatformException(
Expand Down
Loading

0 comments on commit 95642a7

Please sign in to comment.