33 lines
1.0 KiB
Dart
33 lines
1.0 KiB
Dart
import 'package:messaging_app/models/details.dart';
|
|
|
|
class Conversations {
|
|
String? id;
|
|
String chatId;
|
|
Details details;
|
|
DateTime? lastModified;
|
|
|
|
Conversations({
|
|
this.id,
|
|
required this.chatId,
|
|
required this.details,
|
|
this.lastModified,
|
|
});
|
|
|
|
// Convert the details string to a Details object
|
|
// and parse the lastModified string to a DateTime object
|
|
// Note: You may need to adjust the parsing logic based on your data format
|
|
// For example, if _details is a JSON string, you can use json.decode to parse it
|
|
// and create a Details object from the parsed data.
|
|
// Assuming _details is a JSON string, you can use the Details.fromData method
|
|
// to create a Details object.
|
|
// Assuming _lastModified is a string in ISO 8601 format
|
|
|
|
|
|
factory Conversations.fromData(
|
|
String _chatId, String _details, String _lastModified) =>
|
|
Conversations(
|
|
chatId: _chatId,
|
|
details: Details.fromData(_details),
|
|
lastModified: DateTime.parse(_lastModified));
|
|
}
|