diff --git a/packages/shared_preferences/CHANGELOG.md b/packages/shared_preferences/CHANGELOG.md index 9478825e3..c5c7a6c13 100644 --- a/packages/shared_preferences/CHANGELOG.md +++ b/packages/shared_preferences/CHANGELOG.md @@ -1,24 +1,30 @@ ## 1.0.0 -* Initial release +* Initial release. ## 1.0.1 -* Update shared_preferences to 0.5.12+4 -* Update platform interface to 1.0.4 -* Migrate to Tizen 4.0 +* Update shared_preferences to 0.5.12+4. +* Update shared_preferences_platform_interface to 1.0.4. +* Migrate to Tizen 4.0. ## 2.0.0 -* Update Dart and Flutter SDK constraints -* Update Flutter copyright information -* Update example and integration_test -* Update platform interface to 2.0.0 -* Organize dev_dependencies -* Migrate to ffi 1.0.0 -* Migrate to null safety -* Remove unused `PreferenceIsExisiting` from the implementation +* Update Dart and Flutter SDK constraints. +* Update Flutter copyright information. +* Update the example app and integration_test. +* Update shared_preferences_platform_interface to 2.0.0. +* Organize dev_dependencies. +* Migrate to ffi 1.0.0. +* Migrate to null safety. +* Remove unused `PreferenceIsExisiting` from the implementation. ## 2.0.1 -* Fix memory leaks +* Fix memory leaks. + +## 2.0.2 + +* Update shared_preferences to 2.0.9. +* Switch to new analysis options. +* Update integration_test. diff --git a/packages/shared_preferences/README.md b/packages/shared_preferences/README.md index f94393179..0113fc10a 100644 --- a/packages/shared_preferences/README.md +++ b/packages/shared_preferences/README.md @@ -8,8 +8,8 @@ This package is not an _endorsed_ implementation of `shared_preferences`. Theref ```yaml dependencies: - shared_preferences: ^2.0.5 - shared_preferences_tizen: ^2.0.1 + shared_preferences: ^2.0.9 + shared_preferences_tizen: ^2.0.2 ``` Then you can import `shared_preferences` in your Dart code: diff --git a/packages/shared_preferences/analysis_options.yaml b/packages/shared_preferences/analysis_options.yaml deleted file mode 100644 index cda4f6e15..000000000 --- a/packages/shared_preferences/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: ../../analysis_options_legacy.yaml diff --git a/packages/shared_preferences/example/README.md b/packages/shared_preferences/example/README.md index 3a465a328..012ed84b2 100644 --- a/packages/shared_preferences/example/README.md +++ b/packages/shared_preferences/example/README.md @@ -4,4 +4,4 @@ Demonstrates how to use the shared_preferences_tizen plugin. ## Getting Started -To run this app on your Tizen device, use [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen). \ No newline at end of file +To run this app on your Tizen device, use [flutter-tizen](https://github.com/flutter-tizen/flutter-tizen). diff --git a/packages/shared_preferences/example/integration_test/shared_preferences_test.dart b/packages/shared_preferences/example/integration_test/shared_preferences_test.dart index 940d9cb37..7244efe99 100644 --- a/packages/shared_preferences/example/integration_test/shared_preferences_test.dart +++ b/packages/shared_preferences/example/integration_test/shared_preferences_test.dart @@ -2,34 +2,27 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 - -import 'dart:async'; import 'package:flutter_test/flutter_test.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:integration_test/integration_test.dart'; +import 'package:shared_preferences/shared_preferences.dart'; void main() { IntegrationTestWidgetsFlutterBinding.ensureInitialized(); group('$SharedPreferences', () { - const Map kTestValues = { - 'flutter.String': 'hello world', - 'flutter.bool': true, - 'flutter.int': 42, - 'flutter.double': 3.14159, - 'flutter.List': ['foo', 'bar'], - }; + const String testString = 'hello world'; + const bool testBool = true; + const int testInt = 42; + const double testDouble = 3.14159; + const List testList = ['foo', 'bar']; - const Map kTestValues2 = { - 'flutter.String': 'goodbye world', - 'flutter.bool': false, - 'flutter.int': 1337, - 'flutter.double': 2.71828, - 'flutter.List': ['baz', 'quox'], - }; + const String testString2 = 'goodbye world'; + const bool testBool2 = false; + const int testInt2 = 1337; + const double testDouble2 = 2.71828; + const List testList2 = ['baz', 'quox']; - SharedPreferences preferences; + late SharedPreferences preferences; setUp(() async { preferences = await SharedPreferences.getInstance(); @@ -54,43 +47,36 @@ void main() { testWidgets('writing', (WidgetTester _) async { await Future.wait(>[ - preferences.setString( - 'String', kTestValues2['flutter.String'] as String), - preferences.setBool('bool', kTestValues2['flutter.bool'] as bool), - preferences.setInt('int', kTestValues2['flutter.int'] as int), - preferences.setDouble( - 'double', kTestValues2['flutter.double'] as double), - preferences.setStringList( - 'List', kTestValues2['flutter.List'] as List) + preferences.setString('String', testString2), + preferences.setBool('bool', testBool2), + preferences.setInt('int', testInt2), + preferences.setDouble('double', testDouble2), + preferences.setStringList('List', testList2) ]); - expect(preferences.getString('String'), kTestValues2['flutter.String']); - expect(preferences.getBool('bool'), kTestValues2['flutter.bool']); - expect(preferences.getInt('int'), kTestValues2['flutter.int']); - expect(preferences.getDouble('double'), kTestValues2['flutter.double']); - expect(preferences.getStringList('List'), kTestValues2['flutter.List']); + expect(preferences.getString('String'), testString2); + expect(preferences.getBool('bool'), testBool2); + expect(preferences.getInt('int'), testInt2); + expect(preferences.getDouble('double'), testDouble2); + expect(preferences.getStringList('List'), testList2); }); testWidgets('removing', (WidgetTester _) async { const String key = 'testKey'; - await preferences.setString(key, kTestValues['flutter.String'] as String); - await preferences.setBool(key, kTestValues['flutter.bool'] as bool); - await preferences.setInt(key, kTestValues['flutter.int'] as int); - await preferences.setDouble(key, kTestValues['flutter.double'] as double); - await preferences.setStringList( - key, kTestValues['flutter.List'] as List); + await preferences.setString(key, testString); + await preferences.setBool(key, testBool); + await preferences.setInt(key, testInt); + await preferences.setDouble(key, testDouble); + await preferences.setStringList(key, testList); await preferences.remove(key); expect(preferences.get('testKey'), isNull); }); testWidgets('clearing', (WidgetTester _) async { - await preferences.setString( - 'String', kTestValues['flutter.String'] as String); - await preferences.setBool('bool', kTestValues['flutter.bool'] as bool); - await preferences.setInt('int', kTestValues['flutter.int'] as int); - await preferences.setDouble( - 'double', kTestValues['flutter.double'] as double); - await preferences.setStringList( - 'List', kTestValues['flutter.List'] as List); + await preferences.setString('String', testString); + await preferences.setBool('bool', testBool); + await preferences.setInt('int', testInt); + await preferences.setDouble('double', testDouble); + await preferences.setStringList('List', testList); await preferences.clear(); expect(preferences.getString('String'), null); expect(preferences.getBool('bool'), null); diff --git a/packages/shared_preferences/example/pubspec.yaml b/packages/shared_preferences/example/pubspec.yaml index d88d9c41d..ce99c0328 100644 --- a/packages/shared_preferences/example/pubspec.yaml +++ b/packages/shared_preferences/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" dependencies: flutter: sdk: flutter - shared_preferences: ^2.0.5 + shared_preferences: ^2.0.9 shared_preferences_tizen: path: ../ diff --git a/packages/shared_preferences/example/test_driver/integration_test.dart b/packages/shared_preferences/example/test_driver/integration_test.dart index 0603ed6f7..b38629cca 100644 --- a/packages/shared_preferences/example/test_driver/integration_test.dart +++ b/packages/shared_preferences/example/test_driver/integration_test.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - import 'package:integration_test/integration_test_driver.dart'; Future main() => integrationDriver(); diff --git a/packages/shared_preferences/example/tizen/Runner.csproj b/packages/shared_preferences/example/tizen/Runner.csproj index f8346a628..351a83987 100644 --- a/packages/shared_preferences/example/tizen/Runner.csproj +++ b/packages/shared_preferences/example/tizen/Runner.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/packages/shared_preferences/example/tizen/tizen-manifest.xml b/packages/shared_preferences/example/tizen/tizen-manifest.xml index 7d5feeb5a..e7bcbc1d0 100644 --- a/packages/shared_preferences/example/tizen/tizen-manifest.xml +++ b/packages/shared_preferences/example/tizen/tizen-manifest.xml @@ -1,11 +1,10 @@ - + ic_launcher.png - diff --git a/packages/shared_preferences/lib/src/bindings.dart b/packages/shared_preferences/lib/src/bindings.dart index c7d67c916..6bd303109 100644 --- a/packages/shared_preferences/lib/src/bindings.dart +++ b/packages/shared_preferences/lib/src/bindings.dart @@ -10,39 +10,41 @@ import 'types.dart'; class _PreferenceBindings { _PreferenceBindings() { - _lib = DynamicLibrary.open('libcapi-appfw-preference.so.0'); + final DynamicLibrary lib = + DynamicLibrary.open('libcapi-appfw-preference.so.0'); - setInt = _lib.lookupFunction( + setInt = lib.lookupFunction( 'preference_set_int'); - getInt = _lib.lookupFunction( + getInt = lib.lookupFunction( 'preference_get_int'); - - setDouble = _lib.lookupFunction('preference_set_double'); - getDouble = _lib.lookupFunction('preference_get_double'); - - setString = _lib.lookupFunction('preference_set_string'); - getString = _lib.lookupFunction('preference_get_string'); - - setBoolean = _lib.lookupFunction('preference_set_boolean'); - getBoolean = _lib.lookupFunction('preference_get_boolean'); - - remove = _lib.lookupFunction( + setDouble = + lib.lookupFunction( + 'preference_set_double'); + getDouble = + lib.lookupFunction( + 'preference_get_double'); + setString = + lib.lookupFunction( + 'preference_set_string'); + getString = + lib.lookupFunction( + 'preference_get_string'); + setBoolean = + lib.lookupFunction( + 'preference_set_boolean'); + getBoolean = + lib.lookupFunction( + 'preference_get_boolean'); + remove = lib.lookupFunction( 'preference_remove'); - - removeAll = _lib.lookupFunction('preference_remove_all'); - - foreachItem = _lib.lookupFunction('preference_foreach_item'); + removeAll = + lib.lookupFunction( + 'preference_remove_all'); + foreachItem = + lib.lookupFunction( + 'preference_foreach_item'); } - late DynamicLibrary _lib; late PreferenceSetInt setInt; late PreferenceGetInt getInt; late PreferenceSetDouble setDouble; diff --git a/packages/shared_preferences/lib/src/types.dart b/packages/shared_preferences/lib/src/types.dart index b3f5ba15f..808131d77 100644 --- a/packages/shared_preferences/lib/src/types.dart +++ b/packages/shared_preferences/lib/src/types.dart @@ -9,66 +9,65 @@ import 'dart:ffi'; import 'package:ffi/ffi.dart'; // int preference_set_int (const char *key, int value) -typedef preference_set_int_native_t = Int32 Function( - Pointer key, Int32 value); +typedef PreferenceSetIntNative = Int32 Function(Pointer key, Int32 value); typedef PreferenceSetInt = int Function(Pointer key, int value); // int preference_get_int (const char *key, int *value) -typedef preference_get_int_native_t = Int32 Function( +typedef PreferenceGetIntNative = Int32 Function( Pointer key, Pointer value); typedef PreferenceGetInt = int Function( Pointer key, Pointer value); // int preference_set_double (const char *key, double value) -typedef preference_set_double_native_t = Int32 Function( +typedef PreferenceSetDoubleNative = Int32 Function( Pointer key, Double value); typedef PreferenceSetDouble = int Function(Pointer key, double value); // int preference_get_double (const char *key, double *value) -typedef preference_get_double_native_t = Int32 Function( +typedef PreferenceGetDoubleNative = Int32 Function( Pointer key, Pointer value); typedef PreferenceGetDouble = int Function( Pointer key, Pointer value); // int preference_set_string (const char *key, const char *value) -typedef preference_set_string_native_t = Int32 Function( +typedef PreferenceSetStringNative = Int32 Function( Pointer key, Pointer value); typedef PreferenceSetString = int Function( Pointer key, Pointer value); // int preference_get_string (const char *key, char **value) -typedef preference_get_string_native_t = Int32 Function( +typedef PreferenceGetStringNative = Int32 Function( Pointer key, Pointer> value); typedef PreferenceGetString = int Function( Pointer key, Pointer> value); // int preference_set_boolean (const char *key, bool value) -typedef preference_set_boolean_native_t = Int32 Function( +typedef PreferenceSetBooleanNative = Int32 Function( Pointer key, Int8 value); typedef PreferenceSetBoolean = int Function(Pointer key, int value); // int preference_get_boolean (const char *key, bool *value) -typedef preference_get_boolean_native_t = Int32 Function( +typedef PreferenceGetBooleanNative = Int32 Function( Pointer key, Pointer value); typedef PreferenceGetBoolean = int Function( Pointer key, Pointer value); // int preference_remove (const char *key) -typedef preference_remove_native_t = Int32 Function(Pointer key); +typedef PreferenceRemoveNative = Int32 Function(Pointer key); typedef PreferenceRemove = int Function(Pointer key); // int preference_remove_all (void) -typedef preference_remove_all_native_t = Int32 Function(); +typedef PreferenceRemoveAllNative = Int32 Function(); typedef PreferenceRemoveAll = int Function(); // typedef bool(* preference_item_cb )(const char *key, void *user_data) -typedef preference_item_cb_native_t = Int8 Function( +typedef PreferenceItemCallbackNative = Int8 Function( Pointer key, Pointer userData); // int preference_foreach_item (preference_item_cb callback, void *user_data) -typedef preference_foreach_item_native_t = Int32 Function( - Pointer> callback, +typedef PreferenceForeachItemNative = Int32 Function( + Pointer> callback, Pointer userData); typedef PreferenceForeachItem = int Function( - Pointer> callback, + Pointer> callback, Pointer userData); diff --git a/packages/shared_preferences/pubspec.yaml b/packages/shared_preferences/pubspec.yaml index 41fe981cc..00909f9f8 100644 --- a/packages/shared_preferences/pubspec.yaml +++ b/packages/shared_preferences/pubspec.yaml @@ -2,14 +2,13 @@ name: shared_preferences_tizen description: Tizen implementation of the shared_preferences plugin homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/master/packages/shared_preferences -version: 2.0.1 +version: 2.0.2 flutter: plugin: platforms: tizen: dartPluginClass: SharedPreferencesPlugin - fileName: shared_preferences_tizen.dart dependencies: ffi: ^1.1.2