docs(webrtc_controller_flutter): 更新项目文档以反映重构后的架构

AGENTS.md 与 README.md 同步更新:根据实际代码结构重写目录树、技术栈、架构分层及编码规范,移除旧版内联示例并补充新的开发约定与代码生成命令。
This commit is contained in:
2026-08-03 16:12:44 +08:00
parent 1918e5738e
commit d5e66a1777
51 changed files with 4711 additions and 1458 deletions

View File

@@ -0,0 +1,72 @@
import 'package:flutter_webrtc/flutter_webrtc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import '../../../app/constants/app_constants.dart';
part 'connection_session_state.freezed.dart';
/// 连接控制会话的 UI 状态。
@freezed
class ConnectionSessionState with _$ConnectionSessionState {
const factory ConnectionSessionState({
/// 是否已建立 WebRTC 连接(可开始远程控制)。
@Default(false) bool connected,
/// 是否正在连接信令服务器 / 建立 WebRTC。
@Default(false) bool connecting,
/// 状态提示文本。
@Default('') String status,
/// 连接统计文本(每秒刷新)。
@Default('') String stats,
/// 当前视频宽高比。
@Default(16 / 9) double videoAspect,
/// 当前串流模式0=WebRTC 全托管1=自编码。
@Default(0) int streamMode,
/// 自编码解码纹理 id。
int? selfCodecTextureId,
/// 自编码解码器是否就绪。
@Default(false) bool selfCodecReady,
/// 当前平台是否支持自编码硬解。
@Default(true) bool selfCodecSupported,
/// 是否正在录制远程视频。
@Default(false) bool recording,
/// 录制状态提示。
@Default('') String recordStatus,
/// 自编码模式下请求录制时,先切回 WebRTC 标准模式再开始录制。
@Default(false) bool pendingRecordStart,
/// 当前选中的分辨率预设下标。
@Default(0) int selectedResolution,
/// 分辨率预设列表。
@Default(kResolutionOptions) List<Map<String, Object>> resolutionOptions,
/// 帧率档位(收到被控端上报后以上报列表为准)。
@Default(kDefaultFpsOptions) List<int> fpsOptions,
/// 被控端当前采集帧率0 表示尚未收到上报)。
@Default(0) int currentFps,
/// 被控端最近上报的实际采集尺寸(切帧率时保持分辨率不变)。
@Default(0) int lastReportedWidth,
/// 被控端最近上报的实际采集尺寸。
@Default(0) int lastReportedHeight,
/// 远端视频渲染器(未连接为 null
RTCVideoRenderer? renderer,
/// 一次性提示消息(消费后由控制器置空)。
String? alert,
}) = _ConnectionSessionState;
}

View File

@@ -0,0 +1,742 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'connection_session_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$ConnectionSessionState {
/// 是否已建立 WebRTC 连接(可开始远程控制)。
bool get connected => throw _privateConstructorUsedError;
/// 是否正在连接信令服务器 / 建立 WebRTC。
bool get connecting => throw _privateConstructorUsedError;
/// 状态提示文本。
String get status => throw _privateConstructorUsedError;
/// 连接统计文本(每秒刷新)。
String get stats => throw _privateConstructorUsedError;
/// 当前视频宽高比。
double get videoAspect => throw _privateConstructorUsedError;
/// 当前串流模式0=WebRTC 全托管1=自编码。
int get streamMode => throw _privateConstructorUsedError;
/// 自编码解码纹理 id。
int? get selfCodecTextureId => throw _privateConstructorUsedError;
/// 自编码解码器是否就绪。
bool get selfCodecReady => throw _privateConstructorUsedError;
/// 当前平台是否支持自编码硬解。
bool get selfCodecSupported => throw _privateConstructorUsedError;
/// 是否正在录制远程视频。
bool get recording => throw _privateConstructorUsedError;
/// 录制状态提示。
String get recordStatus => throw _privateConstructorUsedError;
/// 自编码模式下请求录制时,先切回 WebRTC 标准模式再开始录制。
bool get pendingRecordStart => throw _privateConstructorUsedError;
/// 当前选中的分辨率预设下标。
int get selectedResolution => throw _privateConstructorUsedError;
/// 分辨率预设列表。
List<Map<String, Object>> get resolutionOptions =>
throw _privateConstructorUsedError;
/// 帧率档位(收到被控端上报后以上报列表为准)。
List<int> get fpsOptions => throw _privateConstructorUsedError;
/// 被控端当前采集帧率0 表示尚未收到上报)。
int get currentFps => throw _privateConstructorUsedError;
/// 被控端最近上报的实际采集尺寸(切帧率时保持分辨率不变)。
int get lastReportedWidth => throw _privateConstructorUsedError;
/// 被控端最近上报的实际采集尺寸。
int get lastReportedHeight => throw _privateConstructorUsedError;
/// 远端视频渲染器(未连接为 null
RTCVideoRenderer? get renderer => throw _privateConstructorUsedError;
/// 一次性提示消息(消费后由控制器置空)。
String? get alert => throw _privateConstructorUsedError;
/// Create a copy of ConnectionSessionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ConnectionSessionStateCopyWith<ConnectionSessionState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $ConnectionSessionStateCopyWith<$Res> {
factory $ConnectionSessionStateCopyWith(
ConnectionSessionState value,
$Res Function(ConnectionSessionState) then,
) = _$ConnectionSessionStateCopyWithImpl<$Res, ConnectionSessionState>;
@useResult
$Res call({
bool connected,
bool connecting,
String status,
String stats,
double videoAspect,
int streamMode,
int? selfCodecTextureId,
bool selfCodecReady,
bool selfCodecSupported,
bool recording,
String recordStatus,
bool pendingRecordStart,
int selectedResolution,
List<Map<String, Object>> resolutionOptions,
List<int> fpsOptions,
int currentFps,
int lastReportedWidth,
int lastReportedHeight,
RTCVideoRenderer? renderer,
String? alert,
});
}
/// @nodoc
class _$ConnectionSessionStateCopyWithImpl<
$Res,
$Val extends ConnectionSessionState
>
implements $ConnectionSessionStateCopyWith<$Res> {
_$ConnectionSessionStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of ConnectionSessionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? connected = null,
Object? connecting = null,
Object? status = null,
Object? stats = null,
Object? videoAspect = null,
Object? streamMode = null,
Object? selfCodecTextureId = freezed,
Object? selfCodecReady = null,
Object? selfCodecSupported = null,
Object? recording = null,
Object? recordStatus = null,
Object? pendingRecordStart = null,
Object? selectedResolution = null,
Object? resolutionOptions = null,
Object? fpsOptions = null,
Object? currentFps = null,
Object? lastReportedWidth = null,
Object? lastReportedHeight = null,
Object? renderer = freezed,
Object? alert = freezed,
}) {
return _then(
_value.copyWith(
connected: null == connected
? _value.connected
: connected // ignore: cast_nullable_to_non_nullable
as bool,
connecting: null == connecting
? _value.connecting
: connecting // ignore: cast_nullable_to_non_nullable
as bool,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
stats: null == stats
? _value.stats
: stats // ignore: cast_nullable_to_non_nullable
as String,
videoAspect: null == videoAspect
? _value.videoAspect
: videoAspect // ignore: cast_nullable_to_non_nullable
as double,
streamMode: null == streamMode
? _value.streamMode
: streamMode // ignore: cast_nullable_to_non_nullable
as int,
selfCodecTextureId: freezed == selfCodecTextureId
? _value.selfCodecTextureId
: selfCodecTextureId // ignore: cast_nullable_to_non_nullable
as int?,
selfCodecReady: null == selfCodecReady
? _value.selfCodecReady
: selfCodecReady // ignore: cast_nullable_to_non_nullable
as bool,
selfCodecSupported: null == selfCodecSupported
? _value.selfCodecSupported
: selfCodecSupported // ignore: cast_nullable_to_non_nullable
as bool,
recording: null == recording
? _value.recording
: recording // ignore: cast_nullable_to_non_nullable
as bool,
recordStatus: null == recordStatus
? _value.recordStatus
: recordStatus // ignore: cast_nullable_to_non_nullable
as String,
pendingRecordStart: null == pendingRecordStart
? _value.pendingRecordStart
: pendingRecordStart // ignore: cast_nullable_to_non_nullable
as bool,
selectedResolution: null == selectedResolution
? _value.selectedResolution
: selectedResolution // ignore: cast_nullable_to_non_nullable
as int,
resolutionOptions: null == resolutionOptions
? _value.resolutionOptions
: resolutionOptions // ignore: cast_nullable_to_non_nullable
as List<Map<String, Object>>,
fpsOptions: null == fpsOptions
? _value.fpsOptions
: fpsOptions // ignore: cast_nullable_to_non_nullable
as List<int>,
currentFps: null == currentFps
? _value.currentFps
: currentFps // ignore: cast_nullable_to_non_nullable
as int,
lastReportedWidth: null == lastReportedWidth
? _value.lastReportedWidth
: lastReportedWidth // ignore: cast_nullable_to_non_nullable
as int,
lastReportedHeight: null == lastReportedHeight
? _value.lastReportedHeight
: lastReportedHeight // ignore: cast_nullable_to_non_nullable
as int,
renderer: freezed == renderer
? _value.renderer
: renderer // ignore: cast_nullable_to_non_nullable
as RTCVideoRenderer?,
alert: freezed == alert
? _value.alert
: alert // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$ConnectionSessionStateImplCopyWith<$Res>
implements $ConnectionSessionStateCopyWith<$Res> {
factory _$$ConnectionSessionStateImplCopyWith(
_$ConnectionSessionStateImpl value,
$Res Function(_$ConnectionSessionStateImpl) then,
) = __$$ConnectionSessionStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
bool connected,
bool connecting,
String status,
String stats,
double videoAspect,
int streamMode,
int? selfCodecTextureId,
bool selfCodecReady,
bool selfCodecSupported,
bool recording,
String recordStatus,
bool pendingRecordStart,
int selectedResolution,
List<Map<String, Object>> resolutionOptions,
List<int> fpsOptions,
int currentFps,
int lastReportedWidth,
int lastReportedHeight,
RTCVideoRenderer? renderer,
String? alert,
});
}
/// @nodoc
class __$$ConnectionSessionStateImplCopyWithImpl<$Res>
extends
_$ConnectionSessionStateCopyWithImpl<$Res, _$ConnectionSessionStateImpl>
implements _$$ConnectionSessionStateImplCopyWith<$Res> {
__$$ConnectionSessionStateImplCopyWithImpl(
_$ConnectionSessionStateImpl _value,
$Res Function(_$ConnectionSessionStateImpl) _then,
) : super(_value, _then);
/// Create a copy of ConnectionSessionState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? connected = null,
Object? connecting = null,
Object? status = null,
Object? stats = null,
Object? videoAspect = null,
Object? streamMode = null,
Object? selfCodecTextureId = freezed,
Object? selfCodecReady = null,
Object? selfCodecSupported = null,
Object? recording = null,
Object? recordStatus = null,
Object? pendingRecordStart = null,
Object? selectedResolution = null,
Object? resolutionOptions = null,
Object? fpsOptions = null,
Object? currentFps = null,
Object? lastReportedWidth = null,
Object? lastReportedHeight = null,
Object? renderer = freezed,
Object? alert = freezed,
}) {
return _then(
_$ConnectionSessionStateImpl(
connected: null == connected
? _value.connected
: connected // ignore: cast_nullable_to_non_nullable
as bool,
connecting: null == connecting
? _value.connecting
: connecting // ignore: cast_nullable_to_non_nullable
as bool,
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
stats: null == stats
? _value.stats
: stats // ignore: cast_nullable_to_non_nullable
as String,
videoAspect: null == videoAspect
? _value.videoAspect
: videoAspect // ignore: cast_nullable_to_non_nullable
as double,
streamMode: null == streamMode
? _value.streamMode
: streamMode // ignore: cast_nullable_to_non_nullable
as int,
selfCodecTextureId: freezed == selfCodecTextureId
? _value.selfCodecTextureId
: selfCodecTextureId // ignore: cast_nullable_to_non_nullable
as int?,
selfCodecReady: null == selfCodecReady
? _value.selfCodecReady
: selfCodecReady // ignore: cast_nullable_to_non_nullable
as bool,
selfCodecSupported: null == selfCodecSupported
? _value.selfCodecSupported
: selfCodecSupported // ignore: cast_nullable_to_non_nullable
as bool,
recording: null == recording
? _value.recording
: recording // ignore: cast_nullable_to_non_nullable
as bool,
recordStatus: null == recordStatus
? _value.recordStatus
: recordStatus // ignore: cast_nullable_to_non_nullable
as String,
pendingRecordStart: null == pendingRecordStart
? _value.pendingRecordStart
: pendingRecordStart // ignore: cast_nullable_to_non_nullable
as bool,
selectedResolution: null == selectedResolution
? _value.selectedResolution
: selectedResolution // ignore: cast_nullable_to_non_nullable
as int,
resolutionOptions: null == resolutionOptions
? _value._resolutionOptions
: resolutionOptions // ignore: cast_nullable_to_non_nullable
as List<Map<String, Object>>,
fpsOptions: null == fpsOptions
? _value._fpsOptions
: fpsOptions // ignore: cast_nullable_to_non_nullable
as List<int>,
currentFps: null == currentFps
? _value.currentFps
: currentFps // ignore: cast_nullable_to_non_nullable
as int,
lastReportedWidth: null == lastReportedWidth
? _value.lastReportedWidth
: lastReportedWidth // ignore: cast_nullable_to_non_nullable
as int,
lastReportedHeight: null == lastReportedHeight
? _value.lastReportedHeight
: lastReportedHeight // ignore: cast_nullable_to_non_nullable
as int,
renderer: freezed == renderer
? _value.renderer
: renderer // ignore: cast_nullable_to_non_nullable
as RTCVideoRenderer?,
alert: freezed == alert
? _value.alert
: alert // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
class _$ConnectionSessionStateImpl implements _ConnectionSessionState {
const _$ConnectionSessionStateImpl({
this.connected = false,
this.connecting = false,
this.status = '',
this.stats = '',
this.videoAspect = 16 / 9,
this.streamMode = 0,
this.selfCodecTextureId,
this.selfCodecReady = false,
this.selfCodecSupported = true,
this.recording = false,
this.recordStatus = '',
this.pendingRecordStart = false,
this.selectedResolution = 0,
final List<Map<String, Object>> resolutionOptions = kResolutionOptions,
final List<int> fpsOptions = kDefaultFpsOptions,
this.currentFps = 0,
this.lastReportedWidth = 0,
this.lastReportedHeight = 0,
this.renderer,
this.alert,
}) : _resolutionOptions = resolutionOptions,
_fpsOptions = fpsOptions;
/// 是否已建立 WebRTC 连接(可开始远程控制)。
@override
@JsonKey()
final bool connected;
/// 是否正在连接信令服务器 / 建立 WebRTC。
@override
@JsonKey()
final bool connecting;
/// 状态提示文本。
@override
@JsonKey()
final String status;
/// 连接统计文本(每秒刷新)。
@override
@JsonKey()
final String stats;
/// 当前视频宽高比。
@override
@JsonKey()
final double videoAspect;
/// 当前串流模式0=WebRTC 全托管1=自编码。
@override
@JsonKey()
final int streamMode;
/// 自编码解码纹理 id。
@override
final int? selfCodecTextureId;
/// 自编码解码器是否就绪。
@override
@JsonKey()
final bool selfCodecReady;
/// 当前平台是否支持自编码硬解。
@override
@JsonKey()
final bool selfCodecSupported;
/// 是否正在录制远程视频。
@override
@JsonKey()
final bool recording;
/// 录制状态提示。
@override
@JsonKey()
final String recordStatus;
/// 自编码模式下请求录制时,先切回 WebRTC 标准模式再开始录制。
@override
@JsonKey()
final bool pendingRecordStart;
/// 当前选中的分辨率预设下标。
@override
@JsonKey()
final int selectedResolution;
/// 分辨率预设列表。
final List<Map<String, Object>> _resolutionOptions;
/// 分辨率预设列表。
@override
@JsonKey()
List<Map<String, Object>> get resolutionOptions {
if (_resolutionOptions is EqualUnmodifiableListView)
return _resolutionOptions;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_resolutionOptions);
}
/// 帧率档位(收到被控端上报后以上报列表为准)。
final List<int> _fpsOptions;
/// 帧率档位(收到被控端上报后以上报列表为准)。
@override
@JsonKey()
List<int> get fpsOptions {
if (_fpsOptions is EqualUnmodifiableListView) return _fpsOptions;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_fpsOptions);
}
/// 被控端当前采集帧率0 表示尚未收到上报)。
@override
@JsonKey()
final int currentFps;
/// 被控端最近上报的实际采集尺寸(切帧率时保持分辨率不变)。
@override
@JsonKey()
final int lastReportedWidth;
/// 被控端最近上报的实际采集尺寸。
@override
@JsonKey()
final int lastReportedHeight;
/// 远端视频渲染器(未连接为 null
@override
final RTCVideoRenderer? renderer;
/// 一次性提示消息(消费后由控制器置空)。
@override
final String? alert;
@override
String toString() {
return 'ConnectionSessionState(connected: $connected, connecting: $connecting, status: $status, stats: $stats, videoAspect: $videoAspect, streamMode: $streamMode, selfCodecTextureId: $selfCodecTextureId, selfCodecReady: $selfCodecReady, selfCodecSupported: $selfCodecSupported, recording: $recording, recordStatus: $recordStatus, pendingRecordStart: $pendingRecordStart, selectedResolution: $selectedResolution, resolutionOptions: $resolutionOptions, fpsOptions: $fpsOptions, currentFps: $currentFps, lastReportedWidth: $lastReportedWidth, lastReportedHeight: $lastReportedHeight, renderer: $renderer, alert: $alert)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$ConnectionSessionStateImpl &&
(identical(other.connected, connected) ||
other.connected == connected) &&
(identical(other.connecting, connecting) ||
other.connecting == connecting) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.stats, stats) || other.stats == stats) &&
(identical(other.videoAspect, videoAspect) ||
other.videoAspect == videoAspect) &&
(identical(other.streamMode, streamMode) ||
other.streamMode == streamMode) &&
(identical(other.selfCodecTextureId, selfCodecTextureId) ||
other.selfCodecTextureId == selfCodecTextureId) &&
(identical(other.selfCodecReady, selfCodecReady) ||
other.selfCodecReady == selfCodecReady) &&
(identical(other.selfCodecSupported, selfCodecSupported) ||
other.selfCodecSupported == selfCodecSupported) &&
(identical(other.recording, recording) ||
other.recording == recording) &&
(identical(other.recordStatus, recordStatus) ||
other.recordStatus == recordStatus) &&
(identical(other.pendingRecordStart, pendingRecordStart) ||
other.pendingRecordStart == pendingRecordStart) &&
(identical(other.selectedResolution, selectedResolution) ||
other.selectedResolution == selectedResolution) &&
const DeepCollectionEquality().equals(
other._resolutionOptions,
_resolutionOptions,
) &&
const DeepCollectionEquality().equals(
other._fpsOptions,
_fpsOptions,
) &&
(identical(other.currentFps, currentFps) ||
other.currentFps == currentFps) &&
(identical(other.lastReportedWidth, lastReportedWidth) ||
other.lastReportedWidth == lastReportedWidth) &&
(identical(other.lastReportedHeight, lastReportedHeight) ||
other.lastReportedHeight == lastReportedHeight) &&
(identical(other.renderer, renderer) ||
other.renderer == renderer) &&
(identical(other.alert, alert) || other.alert == alert));
}
@override
int get hashCode => Object.hashAll([
runtimeType,
connected,
connecting,
status,
stats,
videoAspect,
streamMode,
selfCodecTextureId,
selfCodecReady,
selfCodecSupported,
recording,
recordStatus,
pendingRecordStart,
selectedResolution,
const DeepCollectionEquality().hash(_resolutionOptions),
const DeepCollectionEquality().hash(_fpsOptions),
currentFps,
lastReportedWidth,
lastReportedHeight,
renderer,
alert,
]);
/// Create a copy of ConnectionSessionState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$ConnectionSessionStateImplCopyWith<_$ConnectionSessionStateImpl>
get copyWith =>
__$$ConnectionSessionStateImplCopyWithImpl<_$ConnectionSessionStateImpl>(
this,
_$identity,
);
}
abstract class _ConnectionSessionState implements ConnectionSessionState {
const factory _ConnectionSessionState({
final bool connected,
final bool connecting,
final String status,
final String stats,
final double videoAspect,
final int streamMode,
final int? selfCodecTextureId,
final bool selfCodecReady,
final bool selfCodecSupported,
final bool recording,
final String recordStatus,
final bool pendingRecordStart,
final int selectedResolution,
final List<Map<String, Object>> resolutionOptions,
final List<int> fpsOptions,
final int currentFps,
final int lastReportedWidth,
final int lastReportedHeight,
final RTCVideoRenderer? renderer,
final String? alert,
}) = _$ConnectionSessionStateImpl;
/// 是否已建立 WebRTC 连接(可开始远程控制)。
@override
bool get connected;
/// 是否正在连接信令服务器 / 建立 WebRTC。
@override
bool get connecting;
/// 状态提示文本。
@override
String get status;
/// 连接统计文本(每秒刷新)。
@override
String get stats;
/// 当前视频宽高比。
@override
double get videoAspect;
/// 当前串流模式0=WebRTC 全托管1=自编码。
@override
int get streamMode;
/// 自编码解码纹理 id。
@override
int? get selfCodecTextureId;
/// 自编码解码器是否就绪。
@override
bool get selfCodecReady;
/// 当前平台是否支持自编码硬解。
@override
bool get selfCodecSupported;
/// 是否正在录制远程视频。
@override
bool get recording;
/// 录制状态提示。
@override
String get recordStatus;
/// 自编码模式下请求录制时,先切回 WebRTC 标准模式再开始录制。
@override
bool get pendingRecordStart;
/// 当前选中的分辨率预设下标。
@override
int get selectedResolution;
/// 分辨率预设列表。
@override
List<Map<String, Object>> get resolutionOptions;
/// 帧率档位(收到被控端上报后以上报列表为准)。
@override
List<int> get fpsOptions;
/// 被控端当前采集帧率0 表示尚未收到上报)。
@override
int get currentFps;
/// 被控端最近上报的实际采集尺寸(切帧率时保持分辨率不变)。
@override
int get lastReportedWidth;
/// 被控端最近上报的实际采集尺寸。
@override
int get lastReportedHeight;
/// 远端视频渲染器(未连接为 null
@override
RTCVideoRenderer? get renderer;
/// 一次性提示消息(消费后由控制器置空)。
@override
String? get alert;
/// Create a copy of ConnectionSessionState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ConnectionSessionStateImplCopyWith<_$ConnectionSessionStateImpl>
get copyWith => throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,58 @@
import 'dart:convert';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'signal_message.freezed.dart';
part 'signal_message.g.dart';
/// 信令消息模型,对应 Android 端的 SignalMessage。
///
/// 字段含义:
/// - [type] 消息类型REGISTER / OFFER / ANSWER / ICE_CANDIDATE
/// - [fromDeviceId] 发送方设备 ID
/// - [toDeviceId] 接收方设备 ID
/// - [deviceType] 设备类型CONTROLLER / CONTROLLED
/// - [payload] JSON 字符串形式的负载SDP / ICE 候选等)
/// - [authType] 鉴权类型CODE动态验证码/ PASSWORD固定密码
/// - [authValue] 鉴权值:动态验证码或固定密码
@freezed
class SignalMessage with _$SignalMessage {
const SignalMessage._();
const factory SignalMessage({
String? type,
String? fromDeviceId,
String? toDeviceId,
String? deviceType,
String? payload,
String? authType,
String? authValue,
}) = _SignalMessage;
factory SignalMessage.fromJson(Map<String, dynamic> json) =>
_$SignalMessageFromJson(json);
/// 便捷构造方法payload 为任意 Map会自动序列化为 JSON 字符串。
factory SignalMessage.withPayload({
required String type,
required String fromDeviceId,
required String toDeviceId,
required String deviceType,
required Map<String, dynamic> payload,
String? authType,
String? authValue,
}) {
return SignalMessage(
type: type,
fromDeviceId: fromDeviceId,
toDeviceId: toDeviceId,
deviceType: deviceType,
payload: jsonEncode(payload),
authType: authType,
authValue: authValue,
);
}
@override
String toString() => jsonEncode(toJson());
}

View File

@@ -0,0 +1,309 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'signal_message.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
SignalMessage _$SignalMessageFromJson(Map<String, dynamic> json) {
return _SignalMessage.fromJson(json);
}
/// @nodoc
mixin _$SignalMessage {
String? get type => throw _privateConstructorUsedError;
String? get fromDeviceId => throw _privateConstructorUsedError;
String? get toDeviceId => throw _privateConstructorUsedError;
String? get deviceType => throw _privateConstructorUsedError;
String? get payload => throw _privateConstructorUsedError;
String? get authType => throw _privateConstructorUsedError;
String? get authValue => throw _privateConstructorUsedError;
/// Serializes this SignalMessage to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
/// Create a copy of SignalMessage
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$SignalMessageCopyWith<SignalMessage> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SignalMessageCopyWith<$Res> {
factory $SignalMessageCopyWith(
SignalMessage value,
$Res Function(SignalMessage) then,
) = _$SignalMessageCopyWithImpl<$Res, SignalMessage>;
@useResult
$Res call({
String? type,
String? fromDeviceId,
String? toDeviceId,
String? deviceType,
String? payload,
String? authType,
String? authValue,
});
}
/// @nodoc
class _$SignalMessageCopyWithImpl<$Res, $Val extends SignalMessage>
implements $SignalMessageCopyWith<$Res> {
_$SignalMessageCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SignalMessage
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? type = freezed,
Object? fromDeviceId = freezed,
Object? toDeviceId = freezed,
Object? deviceType = freezed,
Object? payload = freezed,
Object? authType = freezed,
Object? authValue = freezed,
}) {
return _then(
_value.copyWith(
type: freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as String?,
fromDeviceId: freezed == fromDeviceId
? _value.fromDeviceId
: fromDeviceId // ignore: cast_nullable_to_non_nullable
as String?,
toDeviceId: freezed == toDeviceId
? _value.toDeviceId
: toDeviceId // ignore: cast_nullable_to_non_nullable
as String?,
deviceType: freezed == deviceType
? _value.deviceType
: deviceType // ignore: cast_nullable_to_non_nullable
as String?,
payload: freezed == payload
? _value.payload
: payload // ignore: cast_nullable_to_non_nullable
as String?,
authType: freezed == authType
? _value.authType
: authType // ignore: cast_nullable_to_non_nullable
as String?,
authValue: freezed == authValue
? _value.authValue
: authValue // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$SignalMessageImplCopyWith<$Res>
implements $SignalMessageCopyWith<$Res> {
factory _$$SignalMessageImplCopyWith(
_$SignalMessageImpl value,
$Res Function(_$SignalMessageImpl) then,
) = __$$SignalMessageImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
String? type,
String? fromDeviceId,
String? toDeviceId,
String? deviceType,
String? payload,
String? authType,
String? authValue,
});
}
/// @nodoc
class __$$SignalMessageImplCopyWithImpl<$Res>
extends _$SignalMessageCopyWithImpl<$Res, _$SignalMessageImpl>
implements _$$SignalMessageImplCopyWith<$Res> {
__$$SignalMessageImplCopyWithImpl(
_$SignalMessageImpl _value,
$Res Function(_$SignalMessageImpl) _then,
) : super(_value, _then);
/// Create a copy of SignalMessage
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? type = freezed,
Object? fromDeviceId = freezed,
Object? toDeviceId = freezed,
Object? deviceType = freezed,
Object? payload = freezed,
Object? authType = freezed,
Object? authValue = freezed,
}) {
return _then(
_$SignalMessageImpl(
type: freezed == type
? _value.type
: type // ignore: cast_nullable_to_non_nullable
as String?,
fromDeviceId: freezed == fromDeviceId
? _value.fromDeviceId
: fromDeviceId // ignore: cast_nullable_to_non_nullable
as String?,
toDeviceId: freezed == toDeviceId
? _value.toDeviceId
: toDeviceId // ignore: cast_nullable_to_non_nullable
as String?,
deviceType: freezed == deviceType
? _value.deviceType
: deviceType // ignore: cast_nullable_to_non_nullable
as String?,
payload: freezed == payload
? _value.payload
: payload // ignore: cast_nullable_to_non_nullable
as String?,
authType: freezed == authType
? _value.authType
: authType // ignore: cast_nullable_to_non_nullable
as String?,
authValue: freezed == authValue
? _value.authValue
: authValue // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
@JsonSerializable()
class _$SignalMessageImpl extends _SignalMessage {
const _$SignalMessageImpl({
this.type,
this.fromDeviceId,
this.toDeviceId,
this.deviceType,
this.payload,
this.authType,
this.authValue,
}) : super._();
factory _$SignalMessageImpl.fromJson(Map<String, dynamic> json) =>
_$$SignalMessageImplFromJson(json);
@override
final String? type;
@override
final String? fromDeviceId;
@override
final String? toDeviceId;
@override
final String? deviceType;
@override
final String? payload;
@override
final String? authType;
@override
final String? authValue;
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SignalMessageImpl &&
(identical(other.type, type) || other.type == type) &&
(identical(other.fromDeviceId, fromDeviceId) ||
other.fromDeviceId == fromDeviceId) &&
(identical(other.toDeviceId, toDeviceId) ||
other.toDeviceId == toDeviceId) &&
(identical(other.deviceType, deviceType) ||
other.deviceType == deviceType) &&
(identical(other.payload, payload) || other.payload == payload) &&
(identical(other.authType, authType) ||
other.authType == authType) &&
(identical(other.authValue, authValue) ||
other.authValue == authValue));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(
runtimeType,
type,
fromDeviceId,
toDeviceId,
deviceType,
payload,
authType,
authValue,
);
/// Create a copy of SignalMessage
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SignalMessageImplCopyWith<_$SignalMessageImpl> get copyWith =>
__$$SignalMessageImplCopyWithImpl<_$SignalMessageImpl>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$$SignalMessageImplToJson(this);
}
}
abstract class _SignalMessage extends SignalMessage {
const factory _SignalMessage({
final String? type,
final String? fromDeviceId,
final String? toDeviceId,
final String? deviceType,
final String? payload,
final String? authType,
final String? authValue,
}) = _$SignalMessageImpl;
const _SignalMessage._() : super._();
factory _SignalMessage.fromJson(Map<String, dynamic> json) =
_$SignalMessageImpl.fromJson;
@override
String? get type;
@override
String? get fromDeviceId;
@override
String? get toDeviceId;
@override
String? get deviceType;
@override
String? get payload;
@override
String? get authType;
@override
String? get authValue;
/// Create a copy of SignalMessage
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SignalMessageImplCopyWith<_$SignalMessageImpl> get copyWith =>
throw _privateConstructorUsedError;
}

View File

@@ -0,0 +1,29 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'signal_message.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_$SignalMessageImpl _$$SignalMessageImplFromJson(Map<String, dynamic> json) =>
_$SignalMessageImpl(
type: json['type'] as String?,
fromDeviceId: json['fromDeviceId'] as String?,
toDeviceId: json['toDeviceId'] as String?,
deviceType: json['deviceType'] as String?,
payload: json['payload'] as String?,
authType: json['authType'] as String?,
authValue: json['authValue'] as String?,
);
Map<String, dynamic> _$$SignalMessageImplToJson(_$SignalMessageImpl instance) =>
<String, dynamic>{
'type': instance.type,
'fromDeviceId': instance.fromDeviceId,
'toDeviceId': instance.toDeviceId,
'deviceType': instance.deviceType,
'payload': instance.payload,
'authType': instance.authType,
'authValue': instance.authValue,
};