All models now implement `EquatableMixin`
This commit is contained in:
parent
beb50cb153
commit
d9c1321390
|
@ -1,7 +1,9 @@
|
|||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import 'channel_id.dart';
|
||||
|
||||
/// YouTube channel metadata.
|
||||
class Channel {
|
||||
class Channel with EquatableMixin {
|
||||
/// Channel ID.
|
||||
final ChannelId id;
|
||||
|
||||
|
@ -19,4 +21,7 @@ class Channel {
|
|||
|
||||
@override
|
||||
String toString() => 'Channel ($title)';
|
||||
|
||||
@override
|
||||
List<Object> get props => [id];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart';
|
|||
import '../extensions/helpers_extension.dart';
|
||||
|
||||
/// Encapsulates a valid YouTube channel ID.
|
||||
class ChannelId extends Equatable {
|
||||
class ChannelId with EquatableMixin {
|
||||
/// ID as a string.
|
||||
final String value;
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import '../common/common.dart';
|
||||
import 'playlist_id.dart';
|
||||
|
||||
/// YouTube playlist metadata.
|
||||
class Playlist {
|
||||
class Playlist with EquatableMixin {
|
||||
/// Playlist ID.
|
||||
final PlaylistId id;
|
||||
|
||||
|
@ -27,4 +29,7 @@ class Playlist {
|
|||
|
||||
@override
|
||||
String toString() => 'Playlist ($title)';
|
||||
|
||||
@override
|
||||
List<Object> get props => [id];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import '../extensions/helpers_extension.dart';
|
||||
|
||||
/// Encapsulates a valid YouTube playlist ID.
|
||||
class PlaylistId {
|
||||
class PlaylistId with EquatableMixin {
|
||||
static final _regMatchExp =
|
||||
RegExp(r'youtube\..+?/playlist.*?list=(.*?)(?:&|/|$)');
|
||||
static final _compositeMatchExp = RegExp(
|
||||
|
@ -104,4 +106,7 @@ class PlaylistId {
|
|||
}
|
||||
return PlaylistId(obj.toString());
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object> get props => [value];
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import 'dart:collection';
|
||||
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import '../common/common.dart';
|
||||
import 'video_id.dart';
|
||||
|
||||
/// YouTube video metadata.
|
||||
class Video {
|
||||
class Video with EquatableMixin {
|
||||
/// Video ID.
|
||||
final VideoId id;
|
||||
|
||||
|
@ -50,4 +52,7 @@ class Video {
|
|||
|
||||
@override
|
||||
String toString() => 'Video ($title)';
|
||||
|
||||
@override
|
||||
List<Object> get props => [id];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:equatable/equatable.dart';
|
|||
import '../extensions/helpers_extension.dart';
|
||||
|
||||
/// Encapsulates a valid YouTube video ID.
|
||||
class VideoId extends Equatable {
|
||||
class VideoId with EquatableMixin {
|
||||
static final _regMatchExp = RegExp(r'youtube\..+?/watch.*?v=(.*?)(?:&|/|$)');
|
||||
static final _shortMatchExp = RegExp(r'youtu\.be/(.*?)(?:\?|&|/|$)');
|
||||
static final _embedMatchExp = RegExp(r'youtube\..+?/embed/(.*?)(?:\?|&|/|$)');
|
||||
|
|
Loading…
Reference in New Issue