I'm using stream chat for my app's chat functionality. In which I'm implementing notification.
So when I'm receiving notification in background
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
Above is the function which I call in
main.dart
.Below is the handler of background message.
Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
showLog("firebaseMessagingBackgroundHandler message ===> ${message.data}");
await Firebase.initializeApp();
final chatClient = StreamChat.of(context).client; //in this line I need context but I can't pass the argument.
try {
showLog("in background message received");
showStreamNotification(message, chatClient);
} catch (e) {
showLog(e.toString());
}
}