Skip to content

Commit

Permalink
prepare 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Apr 30, 2021
1 parent f32380d commit ebb57ef
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
## 2.0.0 - Apr 30, 2021

- Stable release for null safety.

- Refactor based on [rx_storage: 1.0.0](https://pub.dev/packages/rx_storage/versions/1.0.0) package:
- Stable release for null safety.

- Add [RxStorage.executeUpdate`](https://pub.dev/documentation/rx_storage/latest/rx_storage/RxStorage/executeUpdate.html): Read–modify–write style.

- Synchronize writing task by key.

- Internal refactoring, optimize performance.

- Add more extensions:
- `getObject`: reads a value of any type from persistent storage.

- `getObjectStream`: observe a Stream of any type from persistent storage.

- `executeUpdateBool`: based on [RxStorage.executeUpdate`](https://pub.dev/documentation/rx_storage/latest/rx_storage/RxStorage/executeUpdate.html).

- `executeUpdateDouble`: based on [RxStorage.executeUpdate`](https://pub.dev/documentation/rx_storage/latest/rx_storage/RxStorage/executeUpdate.html).

- `executeUpdateInt`: based on [RxStorage.executeUpdate`](https://pub.dev/documentation/rx_storage/latest/rx_storage/RxStorage/executeUpdate.html).

- `executeUpdateString`: based on [RxStorage.executeUpdate`](https://pub.dev/documentation/rx_storage/latest/rx_storage/RxStorage/executeUpdate.html).

- `executeUpdateStringList`: based on [RxStorage.executeUpdate`](https://pub.dev/documentation/rx_storage/latest/rx_storage/RxStorage/executeUpdate.html).

- Update docs.

## 2.0.0-nullsafety.0 - Feb 24, 2021

* **Breaking**
Expand Down
7 changes: 7 additions & 0 deletions lib/src/interface/extensions.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:meta/meta.dart';

import '../../rx_shared_preferences.dart';

T _identity<T>(T t) => t;
Expand Down Expand Up @@ -109,13 +111,15 @@ extension RxSharedPreferencesExtension on RxSharedPreferences {
///
/// Read bool value by [key], than transform value by [transformer]
/// and finally save computed value to persistent storage.
@experimental
Future<void> executeUpdateBool(String key, Transformer<bool?> transformer) =>
executeUpdate<bool>(key, _cast, transformer, _identity);

/// `Read–modify–write`.
///
/// Read double value by [key], than transform value by [transformer]
/// and finally save computed value to persistent storage.
@experimental
Future<void> executeUpdateDouble(
String key, Transformer<double?> transformer) =>
executeUpdate<double>(key, _cast, transformer, _identity);
Expand All @@ -124,13 +128,15 @@ extension RxSharedPreferencesExtension on RxSharedPreferences {
///
/// Read int value by [key], than transform value by [transformer]
/// and finally save computed value to persistent storage.
@experimental
Future<void> executeUpdateInt(String key, Transformer<int?> transformer) =>
executeUpdate<int>(key, _cast, transformer, _identity);

/// `Read–modify–write`.
///
/// Read String value by [key], than transform value by [transformer]
/// and finally save computed value to persistent storage.
@experimental
Future<void> executeUpdateString(
String key, Transformer<String?> transformer) =>
executeUpdate<String>(key, _cast, transformer, _identity);
Expand All @@ -139,6 +145,7 @@ extension RxSharedPreferencesExtension on RxSharedPreferences {
///
/// Read List<String> value by [key], than transform value by [transformer]
/// and finally save computed value to persistent storage.
@experimental
Future<void> executeUpdateStringList(
String key, Transformer<List<String>?> transformer) =>
executeUpdate<List<String>>(key, _cast, transformer, _identity);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ packages:
source: hosted
version: "0.12.10"
meta:
dependency: transitive
dependency: "direct main"
description:
name: meta
url: "https://pub.dartlang.org"
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
sdk: flutter
shared_preferences: ^2.0.5
rx_storage: ^1.0.0
meta: ^1.3.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit ebb57ef

Please sign in to comment.