message_segment_calculator 1.0.6 copy "message_segment_calculator: ^1.0.6" to clipboard
message_segment_calculator: ^1.0.6 copied to clipboard

Efficiently calculate SMS segments for messages with support for GSM and UCS-2 encoding. Ideal for apps that require precise SMS length and cost management.

example/example.dart

import 'dart:developer';

import 'package:message_segment_calculator/src/segmented_message.dart';

void main() {
  // Define a sample text for segmentation.
  String sampleText = 'Hello ';

  try {
    // Initialize SegmentedMessage with the provided text.
    SegmentedMessage segmentedMessage = SegmentedMessage(sampleText);

    // Output various properties of the segmented message to understand its structure.
    log("Total Size in Bits: ${segmentedMessage.totalSize}"); // Prints the total size of the message in bits.
    log("Message Size in Bits: ${segmentedMessage.messageSize}"); // Prints the message size in bits, excluding headers.
    log("Segments Count: ${segmentedMessage.segmentsCount}"); // Prints the number of segments the message is divided into.
    log("Number of Characters: ${segmentedMessage.numberOfCharacters}"); // Prints the total number of characters in the message.
    log("Number of Unicode Scalars: ${segmentedMessage.numberOfUnicodeScalars}"); // Prints the number of Unicode scalars in the message.
  } catch (e) {
    // Handle any exceptions that might be thrown during the segmentation process.
    log('An error occurred: $e');
  }
}
8
likes
0
points
159
downloads

Publisher

unverified uploader

Weekly Downloads

Efficiently calculate SMS segments for messages with support for GSM and UCS-2 encoding. Ideal for apps that require precise SMS length and cost management.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

characters, flutter

More

Packages that depend on message_segment_calculator