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

Unable to Initialize Plugin #964

Closed
aawhitfield opened this issue Jan 3, 2021 · 2 comments
Closed

Unable to Initialize Plugin #964

aawhitfield opened this issue Jan 3, 2021 · 2 comments

Comments

@aawhitfield
Copy link

Describe the bug

On app startup, plugin returns this in the console. Unhandled Exception: MissingPluginException(No implementation found for method initialize on channel dexterous.com/flutter/local_notifications)
E/flutter (17502): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157:7)
E/flutter (17502):
E/flutter (17502): #1 FlutterLocalNotificationsPlugin.initialize (package:flutter_local_notifications/src/flutter_local_notifications.dart:103:9)
E/flutter (17502):
E/flutter (17502): #2 main (package:med_rpm/main.dart:143:5)
E/flutter (17502):

I have been using this code for over a year and haven't changed anything here. The plugin has been working just fine.
To Reproduce

  1. Build app
  2. See error

Expected behavior

Normally, the plugin initializes and the app starts. But I can't even get to the main screen in my app since the plug in fails to initialize.

Sample code to reproduce the problem

This is from my main.dart:

if (UniversalPlatform.isAndroid || UniversalPlatform.isIOS) {
///////////////////// More local notification initialization ////////////////////////////
// needed if you intend to initialize in the main function
WidgetsFlutterBinding.ensureInitialized();
// NOTE: if you want to find out if the app was launched via notification then you could use the following call and then do something like
// change the default route of the app
// var notificationAppLaunchDetails =
// await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails();

var initializationSettingsAndroid =
    AndroidInitializationSettings('app_icon');
var initializationSettingsIOS = IOSInitializationSettings(
    onDidReceiveLocalNotification:
        (int id, String title, String body, String payload) async {
  didReceiveLocalNotificationSubject.add(ReceivedNotification(
      id: id, title: title, body: body, payload: payload));
});
var initializationSettings = InitializationSettings(
    initializationSettingsAndroid, initializationSettingsIOS);
await flutterLocalNotificationsPlugin.initialize(initializationSettings,
    onSelectNotification: (String payload) async {
  if (payload != null) {
    print('local notification payload: $payload');
    appOpenedFromLocalNotification = true;
@MaikuB
Copy link
Owner

MaikuB commented Jan 3, 2021

The bug report template requires a link to a repository that can reproduce the problem. The steps you've described don't indicate much as it would imply the plugin completely fails and if so, would be a more widely reported problem. The example app within the repo still builds fine as well. If your code hasn't changed from when it was working then it's likely your issue with your dev environment. That's something that could've changed and not something I can help with

@aawhitfield
Copy link
Author

Thank you. My apologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants