getRecommendedDuration static method

Duration getRecommendedDuration(
  1. String message,
  2. ToastrType type
)

Gets the recommended duration based on message length and type

Implementation

static Duration getRecommendedDuration(String message, ToastrType type) =>
    Duration(
      seconds:
          switch (type) {
            ToastrType.error => 5, // Errors should stay longer
            ToastrType.warning => 4, // Warnings need attention
            ToastrType.success => 3, // Success can be shorter
            ToastrType.info => 3, // Info can be shorter
          } +
          (message.length / 50).ceil(),
    );