roughike / flutter_facebook_login

A Flutter plugin for allowing users to authenticate with native Android & iOS Facebook login SDKs.
BSD 2-Clause "Simplified" License
404 stars 332 forks source link

shared_preferences package is broken when install flutter_facebook_login #262

Open HamzaAlayed opened 4 years ago

HamzaAlayed commented 4 years ago

if install flutter_facebook_login then shared_preferences package get break I got this error E/flutter (10471): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

But when I remove flutter_facebook_login then shared_preferences package back to work again

thoughts?

Screen Shot 2020-04-18 at 2 46 48 AM Screen Shot 2020-04-18 at 2 47 13 AM
windows7lake commented 4 years ago

I got the same error? Does anyone know how to deal with it?

opcadmin commented 4 years ago

Complete the setup of flutter_facebook_login and this error will be gone.

The long story:

I started experiencing "MissingPluginException(No implementation found for method getAll on channel flutter: plugins.flutter.io/shared_preferences)" last night when porting code involving the shared_preferences package into a new project. A whole night's googling didn't give me an answer, and I ended up exhausting all meaningful combinations of Flutter and shared_preferences versions ([1.17.1, 1.12.13] * [0.5.7+2, 0.5.6]), including an apparently working combination of 1.12 by 0.5.6 from the original project, just to make my frustrated self doubting whether my users of the original project are actually suffering from an app that doesn't persist states across app launches...

This morning I prepared two clean Flutter SDKs at versions 1.17.1 and 1.12.13, and started testing shared_preferences with the default app created by "Create a Flutter app in AndroidStudio". To my surprise it just worked. Then I realized the code I ported last night also involves google_sign_in and flutter_facebook_login, so I started adding them into pubspec.yaml one by one, and found out it's the presence of flutter_facebook_login that breaks shared_preference. Having no idea how a "pub got", but not configured or used package ("flutter_facebook_login") can make another package("shared_preferences") throwing out errors that look like its own, the best shot I had was to complete the configuration and see if that's the solution. It appeared that as long as those XML snippets required by flutter_facebook_login are pasted into strings.xml and AndroidManifest.XML, shared_preferences started working properly. For the sake of clarity, values in those XML snippets do not need to be replaced with real facebook app id, for shared_preferences to work.

I think both flutter_facebook_login and shared_preferences shall look into this, as one package doesn't want to break another, and the other doesn't want to be broken by any other packages as well.