> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter Push Notification Setup

> Register Flutter push tokens with the current social.plus Flutter SDK.

Flutter push setup combines native platform configuration with one SDK registration call. Your app obtains the push token through Firebase or the native platform, then passes that token to the social.plus Flutter SDK after the user is signed in.

<Info>
  The Flutter SDK does not create Firebase projects, APNs certificates, or platform permission prompts for you. It registers the token that your app receives from those platform systems.
</Info>

## SDK Surface

| Purpose                           | Current Flutter API                                    | When to call                                                                    |
| --------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------- |
| Register the current device token | `AmityCoreClient.registerDeviceNotification(fcmToken)` | After the SDK has a signed-in user session and your app has a current token.    |
| Unregister the current device     | `AmityCoreClient.unregisterDeviceNotification()`       | On sign-out or when this installation should stop receiving push notifications. |

## Parameters

| Name       | Type     | Required | Description                                                                                |
| ---------- | -------- | -------- | ------------------------------------------------------------------------------------------ |
| `fcmToken` | `String` | Yes      | The token your Flutter app receives from Firebase Messaging or the platform push provider. |

## 1. Configure Platform Push

Configure Firebase Messaging for Flutter using your app's Firebase project:

* Add the Firebase packages that match your FlutterFire setup.
* Run FlutterFire configuration for Android and iOS.
* Add `google-services.json` for Android.
* Add `GoogleService-Info.plist` for iOS.
* Enable Push Notifications capability for the iOS target.
* Upload the required push credentials in the social.plus Console under **Settings > Push Notifications**.

<Note>
  Keep Firebase and FlutterFire package versions in your app, not hardcoded in this docs page. Follow the version matrix for your Flutter, Firebase, and React Native toolchain.
</Note>

## 2. Register the Token

Once your app has a token and the user is signed in to social.plus, register the device token with the SDK.

<CodeGroup>
  ```dart Flutter theme={null}
  final fcmToken = '<fcm-token>';

  await AmityCoreClient.registerDeviceNotification(fcmToken);
  ```
</CodeGroup>

Call the same SDK method again when Firebase reports a refreshed token. The last registration replaces the previous token state for this app installation.

## 3. Unregister on Sign-Out

Unregister when the user signs out or when this app installation should stop receiving push notifications for the current social.plus user.

<CodeGroup>
  ```dart Flutter theme={null}
  await AmityCoreClient.unregisterDeviceNotification();
  ```
</CodeGroup>

## Setup Checklist

* Firebase Messaging is configured for the Flutter app.
* Android and iOS platform files are present in the correct native projects.
* APNs or FCM credentials are uploaded in the social.plus Console.
* The signed-in user token is registered through `AmityCoreClient.registerDeviceNotification(fcmToken)`.
* The device is unregistered through `AmityCoreClient.unregisterDeviceNotification()` on sign-out.
