showNotification method

Future<void> showNotification(
  1. {int? id,
  2. String? title,
  3. String? body,
  4. String? payload}
)

通知を表示する

Implementation

Future<void> showNotification({
  int? id,
  String? title,
  String? body,
  String? payload,
}) async {
  try {
    final notificationDetails = _notificationDetails();

    await _flutterLocalNotificationsPlugin.show(
      id ?? DateTime.now().millisecondsSinceEpoch,
      title,
      body,
      notificationDetails,
      payload: payload,
    );
  } catch (_) {
    throw ServiceException(
      ServiceErrorType.notificationShowError,
      ServiceErrorType.notificationShowError.message,
    );
  }
}