-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(subtitle): handle socket event subtitle
- Loading branch information
1 parent
e3b72df
commit bf2f615
Showing
9 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import 'dart:convert'; | ||
|
||
class Subtitle { | ||
final String participant; | ||
final String content; | ||
Subtitle({ | ||
required this.participant, | ||
required this.content, | ||
}); | ||
|
||
Subtitle copyWith({ | ||
String? participant, | ||
String? content, | ||
}) { | ||
return Subtitle( | ||
participant: participant ?? this.participant, | ||
content: content ?? this.content, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toMap() { | ||
return <String, dynamic>{ | ||
'participant': participant, | ||
'content': content, | ||
}; | ||
} | ||
|
||
factory Subtitle.fromMap(Map<String, dynamic> map) { | ||
return Subtitle( | ||
participant: map['participant'] as String, | ||
content: map['content'] as String, | ||
); | ||
} | ||
|
||
String toJson() => json.encode(toMap()); | ||
|
||
factory Subtitle.fromJson(String source) => | ||
Subtitle.fromMap(json.decode(source) as Map<String, dynamic>); | ||
|
||
@override | ||
String toString() => 'Subtitle(participant: $participant, content: $content)'; | ||
|
||
@override | ||
bool operator ==(covariant Subtitle other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other.participant == participant && other.content == content; | ||
} | ||
|
||
@override | ||
int get hashCode => participant.hashCode ^ content.hashCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters