1. Ensure that the backendless_sdk dependency is added to your pubspec.yaml file.
  2. Import the necessary classes from the backendless_sdk package in your Dart files where you need to use the messaging module.
  3. We have to put Backendless.messaging.publish instead of M(capital M in messaging) and put two positional arguments message and channel name respectively.
void main() async {
 // Initialize Backendless
 await Backendless.initApp(
   applicationId: 'YOUR-APP-ID',
   androidApiKey: 'YOUR-ANDROID-API-KEY',
   iosApiKey: 'YOUR-IOS-API-KEY',
 );

 // Example: Sending a message
 Backendless.messaging.publish(
   'Hello, this is a test message!'
   'channel-name',
 ).then((response) {
   if (kDebugMode) {
     print('Message sent successfully: $response');
   }
 }).catchError((error) {
   if (kDebugMode) {
     print('Error sending message: $error');
   }
 });
}

 

Need Help With Flutter Development?

Work with our skilled Flutter developers to accelerate your project and boost its performance.

Hire Flutter Developers

Support On Demand!

Related Q&A