Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[shared_preferences] Ports SharedPreferencesAndroid to Pigeon #3321

Merged
merged 22 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 2.1.1

* Updates minimum Flutter version to 3.0.
* Converts `SharedPreferencesAndroid` to Pigeon.
* Converts implementation to Pigeon.

## 2.1.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v9.2.3), do not edit directly.
// Autogenerated from Pigeon (v9.2.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon

package io.flutter.plugins.sharedpreferences;
Expand Down Expand Up @@ -55,28 +55,28 @@ protected static ArrayList<Object> wrapError(@NonNull Throwable exception) {
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface SharedPreferencesApi {

/** Removes property from shared preferences data set. */
@NonNull
Boolean remove(@NonNull String key);

/** Adds property to shared preferences data set of type bool. */
@NonNull
Boolean setBool(@NonNull String key, @NonNull Boolean value);

/** Adds property to shared preferences data set of type String. */
@NonNull
Boolean setString(@NonNull String key, @NonNull String value);

/** Adds property to shared preferences data set of type int. */
@NonNull
Boolean setInt(@NonNull String key, @NonNull Object value);

Boolean setInt(@NonNull String key, @NonNull Long value);
/** Adds property to shared preferences data set of type double. */
@NonNull
Boolean setDouble(@NonNull String key, @NonNull Double value);

/** Adds property to shared preferences data set of type List<String>. */
@NonNull
Boolean setStringList(@NonNull String key, @NonNull List<String> value);

/** Removes all properties from shared preferences data set with matching prefix. */
@NonNull
Boolean clearWithPrefix(@NonNull String prefix);

/** Gets all properties from shared preferences data set with matching prefix. */
@NonNull
Map<String, Object> getAllWithPrefix(@NonNull String prefix);

Expand Down Expand Up @@ -187,9 +187,10 @@ static void setup(
ArrayList<Object> wrapped = new ArrayList<Object>();
ArrayList<Object> args = (ArrayList<Object>) message;
String keyArg = (String) args.get(0);
Object valueArg = args.get(1);
Number valueArg = (Number) args.get(1);
try {
Boolean output = api.setInt(keyArg, valueArg);
Boolean output =
api.setInt(keyArg, (valueArg == null) ? null : valueArg.longValue());
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
import androidx.annotation.NonNull;
import java.util.List;

/** SharedPreferencesPlugin */
/**
* An interface used to provide conversion logic between List<String> and String for
* SharedPreferencesPlugin.
*/
public interface SharedPreferencesListEncoder {
/** Converts list to String for storing in shared preferences. */
@NonNull
String encode(@NonNull List<String> list);
tarrinneal marked this conversation as resolved.
Show resolved Hide resolved

/** Converts stored String representing List<String> to List. */
@NonNull
List<String> decode(@NonNull String listString);
}
Loading