Uberhund
Uberhund

Reputation: 3

pub.dev Firebase Messaging example Undefined class 'MessageArguments' eror

The pub.dev Firebase Messaging example located at the link below fails to compile in the Flutter/Android Studio with the following error:

Undefined class 'MessageArguments'.

screen

The source code and libraries are here: [https://github.com/firebase/flutterfire/tree/master/packages/firebase_messaging/firebase_messaging/example][2]

Has anyone successfully compiled this example, and/or do you have suggestions how to resolve this error?

Upvotes: 0

Views: 409

Answers (1)

Md. Yeasin Sheikh
Md. Yeasin Sheikh

Reputation: 63799

You can use this and it is from message.dart

/// Message route arguments.
class MessageArguments {
  /// The RemoteMessage
  final RemoteMessage message;

  /// Whether this message caused the application to open.
  final bool openedApplication;

  // ignore: public_member_api_docs
  MessageArguments(this.message, this.openedApplication);
}

Also It is better to accept null from route.

final MessageArguments? args = ModalRoute.of(context)?.settings.arguments; 

Do a null check when using this args.

Upvotes: 1

Related Questions