# Push Messaging

This section provides API reference details for the Push Messaging module in the Flutter unified plugin.

## enablePush

Enables push messaging.

### Syntax

```dart
PushModule.enablePush();
```

### Returns

- `Future<void>`

### Example

```dart
import 'package:sfmc_push/sfmc_push.dart';

await PushModule.requestSdk();
await PushModule.enablePush();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/enable-push.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)setPushEnabledWithPushEnabled:)

## disablePush

Disables push messaging.

### Syntax

```dart
PushModule.disablePush();
```

### Returns

- `Future<void>`

### Example

```dart
import 'package:sfmc_push/sfmc_push.dart';

await PushModule.requestSdk();
await PushModule.disablePush();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/disable-push.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)setPushEnabledWithPushEnabled:)

## isPushEnabled

Returns the state of the `pushEnabled` flag.

### Syntax

```dart
PushModule.isPushEnabled();
```

### Returns

- `Future<bool>` - A future that indicates whether push messaging is enabled.

### Example

```dart
import 'package:sfmc_push/sfmc_push.dart';

await PushModule.requestSdk();
final enabled = await PushModule.isPushEnabled();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/is-push-enabled.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)isPushEnabled)

## getPushToken

Returns the token that Marketing Cloud uses to send push messages to the device.

### Syntax

```dart
PushModule.getPushToken();
```

### Returns

- `Future<String?>` - A future that completes with the push token string, or `null`.

### Example

```dart
import 'package:sfmc_push/sfmc_push.dart';

await PushModule.requestSdk();
final token = await PushModule.getPushToken();
```

### See Also

- [Android SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/javadocs/SFMCSdk/11.0/pushfeaturemodule/com.salesforce.marketingcloud.pushfeature.push/-push-message-manager/get-push-token.html)
- [iOS SDK Reference](https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/appledocs/PushFeatureSdk/2.0/Classes/PushFeature.html#/c:@CM@PushFeatureSDK@objc\(cs\)SFPushFeature\(im\)deviceToken)

## pushTokenStream

A broadcast stream of push token updates. Emits a new token string when the push token changes.

### Syntax

```dart
PushModule.pushTokenStream;
```

### Returns

- `Stream<String?>`

### Example

```dart
import 'package:sfmc_push/sfmc_push.dart';

await PushModule.requestSdk();
final sub = PushModule.pushTokenStream.listen((token) {
  print('Token updated: $token');
});

await sub.cancel();
```
