-
Notifications
You must be signed in to change notification settings - Fork 249
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
[Critical] Missing implementation in Core #315
Comments
|
@joekendal what version of Amplify flutter are you using? Are you using the package locally or the published versions? #274 talks about upcoming breaking changes, but that has not been published yet. Can you share your app code where you are adding the plugins and calling configure? Also share your |
Version: The code is the same as the tutorial: main.dartimport 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:flutter/material.dart';
import 'package:amplify_core/amplify_core.dart';
import 'package:amplify_analytics_pinpoint/amplify_analytics_pinpoint.dart';
import 'amplifyconfiguration.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _amplifyConfigured = false;
// Instantiate Amplify
Amplify amplifyInstance = Amplify();
@override
void initState() {
super.initState();
_configureAmplify();
}
void _configureAmplify() async {
if (!mounted) return;
// Add Pinpoint and Cognito Plugins
AmplifyAnalyticsPinpoint analyticsPlugin = AmplifyAnalyticsPinpoint();
AmplifyAuthCognito authPlugin = AmplifyAuthCognito();
amplifyInstance.addPlugin(authPlugins: [authPlugin]);
amplifyInstance.addPlugin(analyticsPlugins: [analyticsPlugin]);
// Once Plugins are added, configure Amplify
await amplifyInstance.configure(amplifyconfig);
try {
setState(() {
_amplifyConfigured = true;
});
} catch (e) {
print(e);
}
}
// Send an event to Pinpoint
void _recordEvent() async {
AnalyticsEvent event = AnalyticsEvent("test");
event.properties.addBoolProperty("boolKey", true);
event.properties.addDoubleProperty("doubleKey", 10.0);
event.properties.addIntProperty("intKey", 10);
event.properties.addStringProperty("stringKey", "stringValue");
Amplify.Analytics.recordEvent(event: event);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Amplify Core example app'),
),
body: ListView(
padding: EdgeInsets.all(10.0),
children: <Widget>[
Center(
child: Column(
children: [
const Padding(padding: EdgeInsets.all(5.0)),
Text(_amplifyConfigured ? "configured" : "not configured"),
RaisedButton(
onPressed: _amplifyConfigured ? _recordEvent : null,
child: const Text('record event'))
],
),
)
],
),
),
);
}
}
amplifyconfiguration.dartconst amplifyconfig = ''' {
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"analytics": {
"plugins": {
"awsPinpointAnalyticsPlugin": {
"pinpointAnalytics": {
"appId": my app id,
"region": "eu-west-1"
},
"pinpointTargeting": {
"region": "eu-west-1"
}
}
}
},
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"UserAgent": "aws-amplify-cli/0.1.0",
"Version": "0.1.0",
"IdentityManager": {
"Default": {}
},
"CredentialsProvider": {
"CognitoIdentity": {
"Default": {
"PoolId": "eu-west-2:{{ my pool id }}",
"Region": "eu-west-2"
}
}
},
"Auth": {
"Default": {
"authenticationFlowType": "USER_SRP_AUTH"
}
},
"PinpointAnalytics": {
"Default": {
"AppId": "{{ my app id }}",
"Region": "eu-west-1"
}
},
"PinpointTargeting": {
"Default": {
"Region": "eu-west-1"
}
}
}
}
}
}'''; |
@joekendal could you make just a single call to
I think calling it multiple times is the issue. Let me know if that works. |
@Ashish-Nanda no, same issue :( |
Hey @joekendal I'm looking to reproduce your issue on my machine. Could you provide your pubspec.yaml as well? I'm assuming it's just this:
|
Hi @joekendal I've recreated your project copy pasting what was provided and using the above imports in pubspec.yaml I was not able to reproduce your error, the config works fine and I'm able to send events. Could you try running: Also, what platforms did you test on? |
@fjnoyp this seems to be an issue on desktop. shouldn't flutter packages be compatible with any flutter runtime environment? Where do I need to look in the code to fix this? Happy to try and open a PR to address if someone can give me a clue |
@joekendal, amplify-flutter currently only supports android and iOS environments. +1 here #133 for Desktop support. |
Describe the bug
For some reason, the Amplify Core throws a MissingPluginException as a result of this block of code
You'd think this wouldn't be the case as how could any of the plugins be working for others if there is an incomplete implementation of the core. This is the
dev
channel as well.To Reproduce
Steps to reproduce the behavior:
flutter run
Expected behavior
For the button to be active and its text to appear configured, and for an analytics event to be fired off to Pinpoint
Actual behaviour
Platform
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
The text was updated successfully, but these errors were encountered: