SmsMessage class
SMS Message model representing a single SMS message
This model contains all the information about an SMS message including its content, sender, timestamps, and status.
Example usage:
final sms = SmsMessage(
id: '123',
address: '+1234567890',
body: 'Hello world!',
date: DateTime.now(),
dateSent: DateTime.now(),
type: SmsType.inbox,
read: false,
);
Constructors
- SmsMessage({required String id, required String address, required String body, required DateTime date, required DateTime dateSent, required SmsType type, required bool read})
-
const
-
SmsMessage.fromMap(Map<
String, dynamic> map) -
Creates an SmsMessage from a Map (typically from platform channel)
This method safely converts the map data to proper types
factory
Properties
- address → String
-
Phone number or address that sent/received the SMS
final
- body → String
-
Content/body of the SMS message
final
- date → DateTime
-
Date when the SMS was received
final
- dateSent → DateTime
-
Date when the SMS was sent (may be different from date)
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → String
-
Unique identifier for the SMS message
final
- read → bool
-
Whether the SMS has been read
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → SmsType
-
Type of SMS (inbox, sent, draft, etc.)
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> - Converts the SmsMessage to a Map for serialization
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override