Git Product home page Git Product logo

streaming_shared_preferences's People

Contributors

denchikby avatar jonas-sander avatar jonaswanke avatar mapgoblin avatar roughike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

streaming_shared_preferences's Issues

Using with MultiProvider

in this simple code we can use provider:

Future<void> main() async {
  final preferences = await StreamingSharedPreferences.instance;
  final settings = MyAppSettings(preferences);

  runApp(
    Provider<MyAppSettings>.value(value: settings, child: MyApp()),
  );
}

and now my question is how can i implementing that with MultiProvider?

is this code correct?

  runApp(
    MultiProvider(providers: [
      Provider(builder: (_) => database.userTableDao),
      Provider(builder: (_) => database.postsTableDao),
    ], child: Provider<ApplicationSettings>.value(value: settings, child: OKToast(child: MyHomePage()))),
  );

Thanks in advance

NULL Safety

Hello, I have recently migrated my project to Null Safety, and it this package is contradicting in migrating it. Kindly migrate it to null Safety.

containsKey method

Hello,
There is a containsKey method in shared preferences. Is the method not available for StreamingSharedPreferences?

Thank you

`MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences_macos)` when running tests

Description

I get MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences_macos) error when running the tests of this repository.

image

Steps to reproduce

git clone https://github.com/roughike/streaming_shared_preferences.git
cd streaming_shared_preferences
flutter test

Additional context

Flutter version: 2.10.4

ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.

This error occurs when running the example app:

Running Gradle task 'assembleDebug'...
✓ Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
E/flutter (18643): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
E/flutter (18643): If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
E/flutter (18643): If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.
E/flutter (18643): #0      defaultBinaryMessenger.<anonymous closure> (package:flutter/src/services/binary_messenger.dart:76:7)
E/flutter (18643): #1      defaultBinaryMessenger (package:flutter/src/services/binary_messenger.dart:89:4)
E/flutter (18643): #2      MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:140:62)
E/flutter (18643): #3      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:146:35)
E/flutter (18643): #4      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (18643): #5      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:48)
E/flutter (18643): #6      MethodChannelSharedPreferencesStore.getAll (package:shared_preferences_platform_interface/method_channel_shared_preferences.dart:54:22)
E/flutter (18643): #7      SharedPreferences._getSharedPreferencesMap (package:shared_preferences/shared_preferences.dart:187:57)
E/flutter (18643): #8      SharedPreferences.getInstance (package:shared_preferences/shared_preferences.dart:54:19)
E/flutter (18643): #9      debugObtainSharedPreferencesInstance (package:streaming_shared_preferences/src/streaming_shared_preferences.dart:300:23)
E/flutter (18643): #10     debugObtainSharedPreferencesInstance (package:streaming_shared_preferences/src/streaming_shared_preferences.dart:299:27)
E/flutter (18643): #11     StreamingSharedPreferences.instance (package:streaming_shared_preferences/src/streaming_shared_preferences.dart:40:7)
E/flutter (18643): #12     main (package:privacyidea_authenticator/testPref.dart:25:56)
E/flutter (18643): #13     _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:241:25)
E/flutter (18643): #14     _rootRun (dart:async/zone.dart:1184:13)
E/flutter (18643): #15     _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (18643): #16     _runZoned (dart:async/zone.dart:1619:10)
E/flutter (18643): #17     runZonedGuarded (dart:async/zone.dart:1608:12)
E/flutter (18643): #18     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:233:5)
E/flutter (18643): #19     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
E/flutter (18643): #20     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

To prevent this, the main method should be changed to:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  /// Obtain instance to streaming shared preferences, create MyAppSettings, and
  /// once that's done, run the app.
  final preferences = await StreamingSharedPreferences.instance;
  final settings = MyAppSettings(preferences);

  runApp(MyApp(settings));
}

This should be mentioned in the documentation of this plugin also.

web中报错

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.0, on Microsoft Windows [Version 10.0.17134.984], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] VS Code (version 1.53.2)
[√] Connected device (2 available)
image

Extending PreferenceBuilder to multiple values

I like the PreferenceBuilder a lot. It would be even better if there would be a MultiPreferenceBuilder that allows to listen on multiple changing values, probably with Rx.combineLatest. It is a bit tedious to implement, as we would need to have it for 2, 3, 4, etc. Would it be possible to add such a feature?

Migrate example to Android embedding v2

Description

When running flutter pub get in the example, you will get this warning:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:

  /Users/nils/Desktop/Projects/streaming_shared_preferences/example/android/app/src/main/AndroidManifest.xml uses
  `android:name="io.flutter.app.FutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Running "flutter pub get" in example...                          1,993ms

Question

Do I need to pass the setting from void main to streaming page?

Why can't defaultValue be null?

Is there a reason why defaultValue can't be null?

Providing default values for all preferences is unintuitive ('' for a string instead of null) or for custom types can be quite difficult.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.