/ SDKs / Flutter
SDKs
Chat SDKs Flutter v3
Chat SDKs Flutter
Chat SDKs
Flutter
Version 3
Sendbird Chat SDK v3 for Flutter is no longer supported as a new version is released. Check out our latest Chat SDK v4

Create a scheduled message

Copy link

You can create a scheduled user message to send at a later time by passing ScheduledUserMessageParams as an argument to the createScheduledUserMessage() method.

// Create a scheduled user message.
    final params = ScheduledUserMessageParams(
        scheduledAt: DateTime.now().millisecondsSinceEpoch + 600000, // 10 minutes
        message: 'scheduled test',
        translationTargetLanguages: ['KR', 'ENG'],
      );

// The returned message is a pending message instance for the scheduled message.
// It can be used in the same way as pending message from sendUserMessage().
      final pendingScheduledUserMessage =
          await channel.createScheduledUserMessage(params);
}

You can also create a scheduled file message to send at a later time by passing ScheduledFileMessageParams as an argument to the createScheduledFileMessage() method.

// Create a scheduled file message.
  final imageFile = await getAssetFrom('resources/image.jpeg');
  var params = ScheduledFileMessageParams.withFile(
    imageFile,
    scheduledAt: DateTime.now().millisecondsSinceEpoch + 600000, // 10 minutes
  );

// The returned message is a pending message instance for the scheduled message.
// It can be used in the same way as pending message from sendFileMessage().
  final pendingScheduledFileMessage =
      await channel.createScheduledFileMessage(params);
}