SFMC Core
Marketing Cloud Engagement SDK
Marketing Cloud Mobile App Messaging SDK
Push Messaging
In-App Messaging
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
This section provides API reference details for the Push Messaging module in the Flutter unified plugin.
Enables push messaging.
1PushModule.enablePush();Future<void>1import 'package:sfmc_push/sfmc_push.dart';
2
3await PushModule.requestSdk();
4await PushModule.enablePush();Disables push messaging.
1PushModule.disablePush();Future<void>1import 'package:sfmc_push/sfmc_push.dart';
2
3await PushModule.requestSdk();
4await PushModule.disablePush();Returns the state of the pushEnabled flag.
1PushModule.isPushEnabled();Future<bool> - A future that indicates whether push messaging is enabled.1import 'package:sfmc_push/sfmc_push.dart';
2
3await PushModule.requestSdk();
4final enabled = await PushModule.isPushEnabled();Returns the token that Marketing Cloud uses to send push messages to the device.
1PushModule.getPushToken();Future<String?> - A future that completes with the push token string, or null.1import 'package:sfmc_push/sfmc_push.dart';
2
3await PushModule.requestSdk();
4final token = await PushModule.getPushToken();A broadcast stream of push token updates. Emits a new token string when the push token changes.
1PushModule.pushTokenStream;Stream<String?>1import 'package:sfmc_push/sfmc_push.dart';
2
3await PushModule.requestSdk();
4final sub = PushModule.pushTokenStream.listen((token) {
5 print('Token updated: $token');
6});
7
8await sub.cancel();