updateFirebaseToken static method

Future<void> updateFirebaseToken(
  1. String fcmToken,
  2. String uniqueId,
  3. String fcmServerKey
)

Implementation

static Future<void> updateFirebaseToken(
    String fcmToken, String uniqueId, String fcmServerKey) async {
  final url = Uri.parse(
      // 'https://app.quickconnect.biz/api/api/v1/store-firebase-token');
      'https://wms-uat.worldlink.com.np/api/api/v1/store-firebase-token');

  final body = {
    'fcm_server_key': fcmServerKey,
    'firebase_token': fcmToken,
    'client_unique_id': uniqueId,
  };

  try {
    final response = await http.post(url, body: body);

    if (response.statusCode == 200) {
      debugPrint('FCM Token updated successfully');
    } else {
      debugPrint(
          'Failed to update FCM Token: ${response.statusCode} ${response.body}');
    }
  } catch (e) {
    debugPrint('Error updating FCM Token: $e');
  }
}