fix formatting

This commit is contained in:
Fabian Freund
2026-07-30 15:00:26 +02:00
parent 74c9d9c81b
commit fcfde0dc3b
20 changed files with 4517 additions and 3084 deletions
@@ -58,7 +58,7 @@ final class PersistedBoolProvider
} }
} }
String _$persistedBoolHash() => r'97fd7ed82dfde444fddf4475a3982be00f5f197a'; String _$persistedBoolHash() => r'b73ab03b1a9a81c27174393484b77e107be9cf50';
final class PersistedBoolFamily extends $Family final class PersistedBoolFamily extends $Family
with with
@@ -843,7 +843,7 @@ final class PinnedAddonIdsProvider
} }
} }
String _$pinnedAddonIdsHash() => r'4f46cd69d4817e6e19e4d04f4fdcf83d5e2efb8c'; String _$pinnedAddonIdsHash() => r'93a3e6944156569eb6eca2bb934c8e94e64484ad';
abstract class _$PinnedAddonIds extends $Notifier<Set<String>> { abstract class _$PinnedAddonIds extends $Notifier<Set<String>> {
Set<String> build(); Set<String> build();
@@ -45,7 +45,7 @@ final class BookmarkListUiStateNotifierProvider
} }
String _$bookmarkListUiStateNotifierHash() => String _$bookmarkListUiStateNotifierHash() =>
r'13f01daba9d1591c700e956428f0e0e8cb2bfe92'; r'ec34d3b9263463574de71dce9ab349668862c598';
@JsonPersist() @JsonPersist()
abstract class _$BookmarkListUiStateNotifierBase abstract class _$BookmarkListUiStateNotifierBase
@@ -42,7 +42,7 @@ final class BookmarkSearchResultsProvider
} }
String _$bookmarkSearchResultsHash() => String _$bookmarkSearchResultsHash() =>
r'49ebd21a137bc09bbd67b692aacb2554b8364564'; r'1708ae3df94113ab370086af38f9cc150d46d3c5';
abstract class _$BookmarkSearchResults extends $Notifier<List<BookmarkEntry>> { abstract class _$BookmarkSearchResults extends $Notifier<List<BookmarkEntry>> {
List<BookmarkEntry> build(); List<BookmarkEntry> build();
@@ -42,7 +42,7 @@ final class BookmarksRepositoryProvider
} }
String _$bookmarksRepositoryHash() => String _$bookmarksRepositoryHash() =>
r'bf95d30f21773e931b12fd85d03d072d88d5b715'; r'20f005705d6235289f252bd9b17eb5f2227287ac';
abstract class _$BookmarksRepository extends $Notifier<int> { abstract class _$BookmarksRepository extends $Notifier<int> {
int build(); int build();
@@ -42,7 +42,7 @@ final class TabsViewModeControllerProvider
} }
String _$tabsViewModeControllerHash() => String _$tabsViewModeControllerHash() =>
r'e013b174218fcad81981f7d939cf161c3b002adc'; r'f1da070a3cd00dbdc75f36120e202fa4f822fd5b';
abstract class _$TabsViewModeController extends $Notifier<TabsViewMode> { abstract class _$TabsViewModeController extends $Notifier<TabsViewMode> {
TabsViewMode build(); TabsViewMode build();
@@ -97,7 +97,7 @@ final class TabViewFilterControllerProvider
} }
String _$tabViewFilterControllerHash() => String _$tabViewFilterControllerHash() =>
r'6f5d42761765c0135bf40953c574c17d141ffab2'; r'bbed4900c337629061550b6595d0fa0e0d52362d';
@JsonPersist() @JsonPersist()
abstract class _$TabViewFilterControllerBase abstract class _$TabViewFilterControllerBase
@@ -44,7 +44,7 @@ final class HistoryVisitsFilterProvider
} }
String _$historyVisitsFilterHash() => String _$historyVisitsFilterHash() =>
r'4c1530cfd2d94b1cdbb04fbe2df8037cb211a668'; r'dca9d17bcaa5c5db2757edf59a8a23e2aebe8c99';
@JsonPersist() @JsonPersist()
abstract class _$HistoryVisitsFilterBase abstract class _$HistoryVisitsFilterBase
@@ -101,7 +101,7 @@ final class HistoryDownloadsFilterProvider
} }
String _$historyDownloadsFilterHash() => String _$historyDownloadsFilterHash() =>
r'b44de5aced7dadba361fddf69b8462ff92252a99'; r'30514069187520cf003759ba3f406a0adf9c5620';
@JsonPersist() @JsonPersist()
abstract class _$HistoryDownloadsFilterBase abstract class _$HistoryDownloadsFilterBase
@@ -94,7 +94,7 @@ final class SearchModuleOrderProvider
} }
} }
String _$searchModuleOrderHash() => r'fde46e0a0998152340801cb323335a2f4a0f3557'; String _$searchModuleOrderHash() => r'153cebf32e0bf7b42c4eaaa113b0ca5f36851b5f';
final class SearchModuleOrderFamily extends $Family final class SearchModuleOrderFamily extends $Family
with with
@@ -41,7 +41,7 @@ final class SelectedContainerProvider
} }
} }
String _$selectedContainerHash() => r'3c9ab093bce7cd3b84e0318095b1ada25bdf8a65'; String _$selectedContainerHash() => r'29ca2ed41d5f9029bdd3345334717f3ca062db0d';
abstract class _$SelectedContainer extends $Notifier<String?> { abstract class _$SelectedContainer extends $Notifier<String?> {
String? build(); String? build();
@@ -45,7 +45,7 @@ final class WebSearchSettingsControllerProvider
} }
String _$webSearchSettingsControllerHash() => String _$webSearchSettingsControllerHash() =>
r'f21a6203fdb8b21c28b0ddd23f1b48768673138e'; r'969a3998abc34280b34de2b4789645a4d68c0c77';
@JsonPersist() @JsonPersist()
abstract class _$WebSearchSettingsControllerBase abstract class _$WebSearchSettingsControllerBase
@@ -224,7 +224,7 @@ final class SmallWebSessionControllerProvider
} }
String _$smallWebSessionControllerHash() => String _$smallWebSessionControllerHash() =>
r'ee57d24b33b5a7dffe668fe3ddd2b77d84f58eae'; r'd80b9c002bf28a024373b0a6ee036bddff4fe8e0';
abstract class _$SmallWebSessionController abstract class _$SmallWebSessionController
extends $Notifier<AsyncValue<SmallWebSessionState>> { extends $Notifier<AsyncValue<SmallWebSessionState>> {
@@ -42,7 +42,7 @@ final class BackupDirectoryUriProvider
} }
String _$backupDirectoryUriHash() => String _$backupDirectoryUriHash() =>
r'4e5f4e7bde90b2a92c559afe8774ed5ee503277d'; r'966118c9ec159615de5f37527fa8da4ca1e713d1';
abstract class _$BackupDirectoryUri extends $Notifier<Uri?> { abstract class _$BackupDirectoryUri extends $Notifier<Uri?> {
Uri? build(); Uri? build();
@@ -214,8 +214,10 @@ class EngineSettingsRepository extends _$EngineSettingsRepository {
DriftSqlType.bool, DriftSqlType.bool,
db.typeMapping, db.typeMapping,
), ),
'forceUserScalableContent': settings['forceUserScalableContent'] 'forceUserScalableContent': settings['forceUserScalableContent']?.readAs(
?.readAs(DriftSqlType.bool, db.typeMapping), DriftSqlType.bool,
db.typeMapping,
),
// Process Isolation Settings // Process Isolation Settings
'fissionEnabled': settings['fissionEnabled']?.readAs( 'fissionEnabled': settings['fissionEnabled']?.readAs(
DriftSqlType.bool, DriftSqlType.bool,
File diff suppressed because it is too large Load Diff
@@ -3100,7 +3100,10 @@ abstract class GeckoAppLinksApi {
/// is alive, consume it (double-resolve is a no-op), then perform side effects /// is alive, consume it (double-resolve is a no-op), then perform side effects
/// after releasing the store lock (§2.6). /// after releasing the store lock (§2.6).
@async @async
AppLinkResolutionResult resolvePendingAppLink(int requestId, AppLinkDecision decision); AppLinkResolutionResult resolvePendingAppLink(
int requestId,
AppLinkDecision decision,
);
/// Resolve [url] to an external-app target. /// Resolve [url] to an external-app target.
/// ///
@@ -10,9 +10,9 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting;
Object? _extractReplyValueOrThrow( Object? _extractReplyValueOrThrow(
List<Object?>? replyList, List<Object?>? replyList,
String channelName, { String channelName, {
required bool isNullValid, required bool isNullValid,
}) { }) {
if (replyList == null) { if (replyList == null) {
throw PlatformException( throw PlatformException(
@@ -34,8 +34,11 @@ Object? _extractReplyValueOrThrow(
return replyList.firstOrNull; return replyList.firstOrNull;
} }
List<Object?> wrapResponse({
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) { Object? result,
PlatformException? error,
bool empty = false,
}) {
if (empty) { if (empty) {
return <Object?>[]; return <Object?>[];
} }
@@ -44,6 +47,7 @@ List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty
} }
return <Object?>[error.code, error.message, error.details]; return <Object?>[error.code, error.message, error.details];
} }
bool _deepEquals(Object? a, Object? b) { bool _deepEquals(Object? a, Object? b) {
if (identical(a, b)) { if (identical(a, b)) {
return true; return true;
@@ -56,8 +60,9 @@ bool _deepEquals(Object? a, Object? b) {
} }
if (a is List && b is List) { if (a is List && b is List) {
return a.length == b.length && return a.length == b.length &&
a.indexed a.indexed.every(
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]),
);
} }
if (a is Map && b is Map) { if (a is Map && b is Map) {
if (a.length != b.length) { if (a.length != b.length) {
@@ -106,7 +111,6 @@ int _deepHash(Object? value) {
return value.hashCode; return value.hashCode;
} }
enum SingboxProxyProfileType { enum SingboxProxyProfileType {
socks, socks,
http, http,
@@ -125,13 +129,7 @@ enum SingboxProxyProfileType {
customOutbound, customOutbound,
} }
enum SingboxProxyRuntimeStatus { enum SingboxProxyRuntimeStatus { stopped, starting, running, stopping, error }
stopped,
starting,
running,
stopping,
error,
}
class SingboxProxyProfile { class SingboxProxyProfile {
SingboxProxyProfile({ SingboxProxyProfile({
@@ -157,17 +155,12 @@ class SingboxProxyProfile {
String? secretJson; String? secretJson;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[id, name, type, configJson, secretJson];
id,
name,
type,
configJson,
secretJson,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyProfile decode(Object result) { static SingboxProxyProfile decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -189,7 +182,11 @@ class SingboxProxyProfile {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(id, other.id) && _deepEquals(name, other.name) && _deepEquals(type, other.type) && _deepEquals(configJson, other.configJson) && _deepEquals(secretJson, other.secretJson); return _deepEquals(id, other.id) &&
_deepEquals(name, other.name) &&
_deepEquals(type, other.type) &&
_deepEquals(configJson, other.configJson) &&
_deepEquals(secretJson, other.secretJson);
} }
@override @override
@@ -239,7 +236,8 @@ class SingboxProxyRuntimeOptions {
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyRuntimeOptions decode(Object result) { static SingboxProxyRuntimeOptions decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -254,13 +252,17 @@ class SingboxProxyRuntimeOptions {
@override @override
// ignore: avoid_equals_and_hash_code_on_mutable_classes // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) { bool operator ==(Object other) {
if (other is! SingboxProxyRuntimeOptions || other.runtimeType != runtimeType) { if (other is! SingboxProxyRuntimeOptions ||
other.runtimeType != runtimeType) {
return false; return false;
} }
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(preferredBasePort, other.preferredBasePort) && _deepEquals(blockUnmatchedTraffic, other.blockUnmatchedTraffic) && _deepEquals(dnsConfig, other.dnsConfig) && _deepEquals(bootstrapDohUrl, other.bootstrapDohUrl); return _deepEquals(preferredBasePort, other.preferredBasePort) &&
_deepEquals(blockUnmatchedTraffic, other.blockUnmatchedTraffic) &&
_deepEquals(dnsConfig, other.dnsConfig) &&
_deepEquals(bootstrapDohUrl, other.bootstrapDohUrl);
} }
@override @override
@@ -331,7 +333,8 @@ class SingboxProxyDnsServerConfig {
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyDnsServerConfig decode(Object result) { static SingboxProxyDnsServerConfig decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -349,13 +352,20 @@ class SingboxProxyDnsServerConfig {
@override @override
// ignore: avoid_equals_and_hash_code_on_mutable_classes // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) { bool operator ==(Object other) {
if (other is! SingboxProxyDnsServerConfig || other.runtimeType != runtimeType) { if (other is! SingboxProxyDnsServerConfig ||
other.runtimeType != runtimeType) {
return false; return false;
} }
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(tag, other.tag) && _deepEquals(address, other.address) && _deepEquals(detourTag, other.detourTag) && _deepEquals(matchDomainSuffixes, other.matchDomainSuffixes) && _deepEquals(matchGeosites, other.matchGeosites) && _deepEquals(matchOutbounds, other.matchOutbounds) && _deepEquals(matchInbounds, other.matchInbounds); return _deepEquals(tag, other.tag) &&
_deepEquals(address, other.address) &&
_deepEquals(detourTag, other.detourTag) &&
_deepEquals(matchDomainSuffixes, other.matchDomainSuffixes) &&
_deepEquals(matchGeosites, other.matchGeosites) &&
_deepEquals(matchOutbounds, other.matchOutbounds) &&
_deepEquals(matchInbounds, other.matchInbounds);
} }
@override @override
@@ -385,20 +395,18 @@ class SingboxProxyDnsConfig {
String domainStrategy; String domainStrategy;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[servers, finalServerTag, domainStrategy];
servers,
finalServerTag,
domainStrategy,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyDnsConfig decode(Object result) { static SingboxProxyDnsConfig decode(Object result) {
result as List<Object?>; result as List<Object?>;
return SingboxProxyDnsConfig( return SingboxProxyDnsConfig(
servers: (result[0]! as List<Object?>).cast<SingboxProxyDnsServerConfig>(), servers: (result[0]! as List<Object?>)
.cast<SingboxProxyDnsServerConfig>(),
finalServerTag: result[1] as String?, finalServerTag: result[1] as String?,
domainStrategy: result[2]! as String, domainStrategy: result[2]! as String,
); );
@@ -413,7 +421,9 @@ class SingboxProxyDnsConfig {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(servers, other.servers) && _deepEquals(finalServerTag, other.finalServerTag) && _deepEquals(domainStrategy, other.domainStrategy); return _deepEquals(servers, other.servers) &&
_deepEquals(finalServerTag, other.finalServerTag) &&
_deepEquals(domainStrategy, other.domainStrategy);
} }
@override @override
@@ -446,17 +456,12 @@ class SingboxProxyRuntimeEndpoint {
String password; String password;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[profileId, host, port, username, password];
profileId,
host,
port,
username,
password,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyRuntimeEndpoint decode(Object result) { static SingboxProxyRuntimeEndpoint decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -472,13 +477,18 @@ class SingboxProxyRuntimeEndpoint {
@override @override
// ignore: avoid_equals_and_hash_code_on_mutable_classes // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) { bool operator ==(Object other) {
if (other is! SingboxProxyRuntimeEndpoint || other.runtimeType != runtimeType) { if (other is! SingboxProxyRuntimeEndpoint ||
other.runtimeType != runtimeType) {
return false; return false;
} }
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(profileId, other.profileId) && _deepEquals(host, other.host) && _deepEquals(port, other.port) && _deepEquals(username, other.username) && _deepEquals(password, other.password); return _deepEquals(profileId, other.profileId) &&
_deepEquals(host, other.host) &&
_deepEquals(port, other.port) &&
_deepEquals(username, other.username) &&
_deepEquals(password, other.password);
} }
@override @override
@@ -505,21 +515,19 @@ class SingboxProxyRuntimeState {
String? message; String? message;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[status, endpoints, message];
status,
endpoints,
message,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyRuntimeState decode(Object result) { static SingboxProxyRuntimeState decode(Object result) {
result as List<Object?>; result as List<Object?>;
return SingboxProxyRuntimeState( return SingboxProxyRuntimeState(
status: result[0]! as SingboxProxyRuntimeStatus, status: result[0]! as SingboxProxyRuntimeStatus,
endpoints: (result[1]! as List<Object?>).cast<SingboxProxyRuntimeEndpoint>(), endpoints: (result[1]! as List<Object?>)
.cast<SingboxProxyRuntimeEndpoint>(),
message: result[2] as String?, message: result[2] as String?,
); );
} }
@@ -527,13 +535,16 @@ class SingboxProxyRuntimeState {
@override @override
// ignore: avoid_equals_and_hash_code_on_mutable_classes // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) { bool operator ==(Object other) {
if (other is! SingboxProxyRuntimeState || other.runtimeType != runtimeType) { if (other is! SingboxProxyRuntimeState ||
other.runtimeType != runtimeType) {
return false; return false;
} }
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(status, other.status) && _deepEquals(endpoints, other.endpoints) && _deepEquals(message, other.message); return _deepEquals(status, other.status) &&
_deepEquals(endpoints, other.endpoints) &&
_deepEquals(message, other.message);
} }
@override @override
@@ -547,43 +558,41 @@ class SingboxProxyRuntimeState {
} }
class SingboxProxyConfigResult { class SingboxProxyConfigResult {
SingboxProxyConfigResult({ SingboxProxyConfigResult({required this.configJson, required this.endpoints});
required this.configJson,
required this.endpoints,
});
String configJson; String configJson;
List<SingboxProxyRuntimeEndpoint> endpoints; List<SingboxProxyRuntimeEndpoint> endpoints;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[configJson, endpoints];
configJson,
endpoints,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyConfigResult decode(Object result) { static SingboxProxyConfigResult decode(Object result) {
result as List<Object?>; result as List<Object?>;
return SingboxProxyConfigResult( return SingboxProxyConfigResult(
configJson: result[0]! as String, configJson: result[0]! as String,
endpoints: (result[1]! as List<Object?>).cast<SingboxProxyRuntimeEndpoint>(), endpoints: (result[1]! as List<Object?>)
.cast<SingboxProxyRuntimeEndpoint>(),
); );
} }
@override @override
// ignore: avoid_equals_and_hash_code_on_mutable_classes // ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) { bool operator ==(Object other) {
if (other is! SingboxProxyConfigResult || other.runtimeType != runtimeType) { if (other is! SingboxProxyConfigResult ||
other.runtimeType != runtimeType) {
return false; return false;
} }
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(configJson, other.configJson) && _deepEquals(endpoints, other.endpoints); return _deepEquals(configJson, other.configJson) &&
_deepEquals(endpoints, other.endpoints);
} }
@override @override
@@ -613,16 +622,12 @@ class SingboxProxyLogMessage {
String? profileId; String? profileId;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[level, message, timestamp, profileId];
level,
message,
timestamp,
profileId,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static SingboxProxyLogMessage decode(Object result) { static SingboxProxyLogMessage decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -643,7 +648,10 @@ class SingboxProxyLogMessage {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(level, other.level) && _deepEquals(message, other.message) && _deepEquals(timestamp, other.timestamp) && _deepEquals(profileId, other.profileId); return _deepEquals(level, other.level) &&
_deepEquals(message, other.message) &&
_deepEquals(timestamp, other.timestamp) &&
_deepEquals(profileId, other.profileId);
} }
@override @override
@@ -656,7 +664,6 @@ class SingboxProxyLogMessage {
} }
} }
class _PigeonCodec extends StandardMessageCodec { class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec(); const _PigeonCodec();
@override @override
@@ -664,34 +671,34 @@ class _PigeonCodec extends StandardMessageCodec {
if (value is int) { if (value is int) {
buffer.putUint8(4); buffer.putUint8(4);
buffer.putInt64(value); buffer.putInt64(value);
} else if (value is SingboxProxyProfileType) { } else if (value is SingboxProxyProfileType) {
buffer.putUint8(129); buffer.putUint8(129);
writeValue(buffer, value.index); writeValue(buffer, value.index);
} else if (value is SingboxProxyRuntimeStatus) { } else if (value is SingboxProxyRuntimeStatus) {
buffer.putUint8(130); buffer.putUint8(130);
writeValue(buffer, value.index); writeValue(buffer, value.index);
} else if (value is SingboxProxyProfile) { } else if (value is SingboxProxyProfile) {
buffer.putUint8(131); buffer.putUint8(131);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyRuntimeOptions) { } else if (value is SingboxProxyRuntimeOptions) {
buffer.putUint8(132); buffer.putUint8(132);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyDnsServerConfig) { } else if (value is SingboxProxyDnsServerConfig) {
buffer.putUint8(133); buffer.putUint8(133);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyDnsConfig) { } else if (value is SingboxProxyDnsConfig) {
buffer.putUint8(134); buffer.putUint8(134);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyRuntimeEndpoint) { } else if (value is SingboxProxyRuntimeEndpoint) {
buffer.putUint8(135); buffer.putUint8(135);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyRuntimeState) { } else if (value is SingboxProxyRuntimeState) {
buffer.putUint8(136); buffer.putUint8(136);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyConfigResult) { } else if (value is SingboxProxyConfigResult) {
buffer.putUint8(137); buffer.putUint8(137);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is SingboxProxyLogMessage) { } else if (value is SingboxProxyLogMessage) {
buffer.putUint8(138); buffer.putUint8(138);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else { } else {
@@ -734,9 +741,13 @@ class SingboxProxyApi {
/// Constructor for [SingboxProxyApi]. The [binaryMessenger] named argument is /// Constructor for [SingboxProxyApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
SingboxProxyApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) SingboxProxyApi({
: pigeonVar_binaryMessenger = binaryMessenger, BinaryMessenger? binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; String messageChannelSuffix = '',
}) : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
@@ -744,82 +755,97 @@ class SingboxProxyApi {
final String pigeonVar_messageChannelSuffix; final String pigeonVar_messageChannelSuffix;
Future<String?> validateProfile(SingboxProxyProfile profile) async { Future<String?> validateProfile(SingboxProxyProfile profile) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.validateProfile$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.validateProfile$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[profile]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[profile],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
return pigeonVar_replyValue as String?; return pigeonVar_replyValue as String?;
} }
Future<SingboxProxyConfigResult> buildConfig(List<SingboxProxyProfile> profiles, SingboxProxyRuntimeOptions options) async { Future<SingboxProxyConfigResult> buildConfig(
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.buildConfig$pigeonVar_messageChannelSuffix'; List<SingboxProxyProfile> profiles,
SingboxProxyRuntimeOptions options,
) async {
final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.buildConfig$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[profiles, options]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[profiles, options],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as SingboxProxyConfigResult; return pigeonVar_replyValue! as SingboxProxyConfigResult;
} }
Future<SingboxProxyRuntimeState> start(List<SingboxProxyProfile> profiles, SingboxProxyRuntimeOptions options) async { Future<SingboxProxyRuntimeState> start(
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.start$pigeonVar_messageChannelSuffix'; List<SingboxProxyProfile> profiles,
SingboxProxyRuntimeOptions options,
) async {
final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.start$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[profiles, options]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[profiles, options],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as SingboxProxyRuntimeState; return pigeonVar_replyValue! as SingboxProxyRuntimeState;
} }
Future<void> stop(List<String> profileIds) async { Future<void> stop(List<String> profileIds) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.stop$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.stop$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[profileIds]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[profileIds],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
Future<void> stopAll() async { Future<void> stopAll() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.stopAll$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.stopAll$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -829,15 +855,15 @@ class SingboxProxyApi {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
Future<SingboxProxyRuntimeState> getState() async { Future<SingboxProxyRuntimeState> getState() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.getState$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyApi.getState$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -847,11 +873,10 @@ class SingboxProxyApi {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as SingboxProxyRuntimeState; return pigeonVar_replyValue! as SingboxProxyRuntimeState;
} }
} }
@@ -863,46 +888,62 @@ abstract class SingboxProxyEventsApi {
void onLogMessage(SingboxProxyLogMessage message); void onLogMessage(SingboxProxyLogMessage message);
static void setUp(SingboxProxyEventsApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { static void setUp(
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; SingboxProxyEventsApi? api, {
BinaryMessenger? binaryMessenger,
String messageChannelSuffix = '',
}) {
messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
{ {
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyEventsApi.onStateChanged$messageChannelSuffix', pigeonChannelCodec, 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyEventsApi.onStateChanged$messageChannelSuffix',
binaryMessenger: binaryMessenger); pigeonChannelCodec,
binaryMessenger: binaryMessenger,
);
if (api == null) { if (api == null) {
pigeonVar_channel.setMessageHandler(null); pigeonVar_channel.setMessageHandler(null);
} else { } else {
pigeonVar_channel.setMessageHandler((Object? message) async { pigeonVar_channel.setMessageHandler((Object? message) async {
final List<Object?> args = message! as List<Object?>; final List<Object?> args = message! as List<Object?>;
final SingboxProxyRuntimeState arg_state = args[0]! as SingboxProxyRuntimeState; final SingboxProxyRuntimeState arg_state =
args[0]! as SingboxProxyRuntimeState;
try { try {
api.onStateChanged(arg_state); api.onStateChanged(arg_state);
return wrapResponse(empty: true); return wrapResponse(empty: true);
} on PlatformException catch (e) { } on PlatformException catch (e) {
return wrapResponse(error: e); return wrapResponse(error: e);
} catch (e) { } catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()),
);
} }
}); });
} }
} }
{ {
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyEventsApi.onLogMessage$messageChannelSuffix', pigeonChannelCodec, 'dev.flutter.pigeon.flutter_singbox_proxy.SingboxProxyEventsApi.onLogMessage$messageChannelSuffix',
binaryMessenger: binaryMessenger); pigeonChannelCodec,
binaryMessenger: binaryMessenger,
);
if (api == null) { if (api == null) {
pigeonVar_channel.setMessageHandler(null); pigeonVar_channel.setMessageHandler(null);
} else { } else {
pigeonVar_channel.setMessageHandler((Object? message) async { pigeonVar_channel.setMessageHandler((Object? message) async {
final List<Object?> args = message! as List<Object?>; final List<Object?> args = message! as List<Object?>;
final SingboxProxyLogMessage arg_message = args[0]! as SingboxProxyLogMessage; final SingboxProxyLogMessage arg_message =
args[0]! as SingboxProxyLogMessage;
try { try {
api.onLogMessage(arg_message); api.onLogMessage(arg_message);
return wrapResponse(empty: true); return wrapResponse(empty: true);
} on PlatformException catch (e) { } on PlatformException catch (e) {
return wrapResponse(error: e); return wrapResponse(error: e);
} catch (e) { } catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()),
);
} }
}); });
} }
+123 -78
View File
@@ -10,9 +10,9 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting;
Object? _extractReplyValueOrThrow( Object? _extractReplyValueOrThrow(
List<Object?>? replyList, List<Object?>? replyList,
String channelName, { String channelName, {
required bool isNullValid, required bool isNullValid,
}) { }) {
if (replyList == null) { if (replyList == null) {
throw PlatformException( throw PlatformException(
@@ -34,8 +34,11 @@ Object? _extractReplyValueOrThrow(
return replyList.firstOrNull; return replyList.firstOrNull;
} }
List<Object?> wrapResponse({
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) { Object? result,
PlatformException? error,
bool empty = false,
}) {
if (empty) { if (empty) {
return <Object?>[]; return <Object?>[];
} }
@@ -44,6 +47,7 @@ List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty
} }
return <Object?>[error.code, error.message, error.details]; return <Object?>[error.code, error.message, error.details];
} }
bool _deepEquals(Object? a, Object? b) { bool _deepEquals(Object? a, Object? b) {
if (identical(a, b)) { if (identical(a, b)) {
return true; return true;
@@ -56,8 +60,9 @@ bool _deepEquals(Object? a, Object? b) {
} }
if (a is List && b is List) { if (a is List && b is List) {
return a.length == b.length && return a.length == b.length &&
a.indexed a.indexed.every(
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]),
);
} }
if (a is Map && b is Map) { if (a is Map && b is Map) {
if (a.length != b.length) { if (a.length != b.length) {
@@ -106,23 +111,29 @@ int _deepHash(Object? value) {
return value.hashCode; return value.hashCode;
} }
/// Transport types for Tor connections /// Transport types for Tor connections
enum TransportType { enum TransportType {
/// Direct Tor connection (no bridges) /// Direct Tor connection (no bridges)
none, none,
/// obfs4 pluggable transport /// obfs4 pluggable transport
obfs4, obfs4,
/// Snowflake pluggable transport (default broker) /// Snowflake pluggable transport (default broker)
snowflake, snowflake,
/// Snowflake via AMP cache /// Snowflake via AMP cache
snowflakeAmp, snowflakeAmp,
/// Meek pluggable transport /// Meek pluggable transport
meek, meek,
/// Meek via Azure CDN /// Meek via Azure CDN
meekAzure, meekAzure,
/// WebTunnel pluggable transport /// WebTunnel pluggable transport
webtunnel, webtunnel,
/// Custom bridge lines (passthrough) /// Custom bridge lines (passthrough)
custom, custom,
} }
@@ -163,7 +174,8 @@ class TorConfiguration {
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static TorConfiguration decode(Object result) { static TorConfiguration decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -185,7 +197,11 @@ class TorConfiguration {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(transport, other.transport) && _deepEquals(bridgeLines, other.bridgeLines) && _deepEquals(entryNodeCountries, other.entryNodeCountries) && _deepEquals(exitNodeCountries, other.exitNodeCountries) && _deepEquals(strictNodes, other.strictNodes); return _deepEquals(transport, other.transport) &&
_deepEquals(bridgeLines, other.bridgeLines) &&
_deepEquals(entryNodeCountries, other.entryNodeCountries) &&
_deepEquals(exitNodeCountries, other.exitNodeCountries) &&
_deepEquals(strictNodes, other.strictNodes);
} }
@override @override
@@ -234,7 +250,8 @@ class TorStatus {
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static TorStatus decode(Object result) { static TorStatus decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -256,7 +273,11 @@ class TorStatus {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(isRunning, other.isRunning) && _deepEquals(socksPort, other.socksPort) && _deepEquals(bootstrapProgress, other.bootstrapProgress) && _deepEquals(currentCircuit, other.currentCircuit) && _deepEquals(exitNodeCountry, other.exitNodeCountry); return _deepEquals(isRunning, other.isRunning) &&
_deepEquals(socksPort, other.socksPort) &&
_deepEquals(bootstrapProgress, other.bootstrapProgress) &&
_deepEquals(currentCircuit, other.currentCircuit) &&
_deepEquals(exitNodeCountry, other.exitNodeCountry);
} }
@override @override
@@ -287,15 +308,12 @@ class TorLogMessage {
int timestamp; int timestamp;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[severity, message, timestamp];
severity,
message,
timestamp,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static TorLogMessage decode(Object result) { static TorLogMessage decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -315,7 +333,9 @@ class TorLogMessage {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(severity, other.severity) && _deepEquals(message, other.message) && _deepEquals(timestamp, other.timestamp); return _deepEquals(severity, other.severity) &&
_deepEquals(message, other.message) &&
_deepEquals(timestamp, other.timestamp);
} }
@override @override
@@ -328,7 +348,6 @@ class TorLogMessage {
} }
} }
class _PigeonCodec extends StandardMessageCodec { class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec(); const _PigeonCodec();
@override @override
@@ -336,16 +355,16 @@ class _PigeonCodec extends StandardMessageCodec {
if (value is int) { if (value is int) {
buffer.putUint8(4); buffer.putUint8(4);
buffer.putInt64(value); buffer.putInt64(value);
} else if (value is TransportType) { } else if (value is TransportType) {
buffer.putUint8(129); buffer.putUint8(129);
writeValue(buffer, value.index); writeValue(buffer, value.index);
} else if (value is TorConfiguration) { } else if (value is TorConfiguration) {
buffer.putUint8(130); buffer.putUint8(130);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is TorStatus) { } else if (value is TorStatus) {
buffer.putUint8(131); buffer.putUint8(131);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else if (value is TorLogMessage) { } else if (value is TorLogMessage) {
buffer.putUint8(132); buffer.putUint8(132);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else { } else {
@@ -377,8 +396,10 @@ class TorApi {
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
TorApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) TorApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
: pigeonVar_binaryMessenger = binaryMessenger, : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
@@ -388,27 +409,30 @@ class TorApi {
/// Start Tor with the given configuration /// Start Tor with the given configuration
/// Returns a Future to avoid blocking the main thread /// Returns a Future to avoid blocking the main thread
Future<int> startTor(TorConfiguration config) async { Future<int> startTor(TorConfiguration config) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_tor.TorApi.startTor$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_tor.TorApi.startTor$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[config]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[config],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as int; return pigeonVar_replyValue! as int;
} }
/// Stop Tor /// Stop Tor
Future<void> stopTor() async { Future<void> stopTor() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_tor.TorApi.stopTor$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_tor.TorApi.stopTor$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -418,16 +442,16 @@ class TorApi {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
/// Get current status /// Get current status
Future<TorStatus> getStatus() async { Future<TorStatus> getStatus() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_tor.TorApi.getStatus$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_tor.TorApi.getStatus$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -437,17 +461,17 @@ class TorApi {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as TorStatus; return pigeonVar_replyValue! as TorStatus;
} }
/// Request a new Tor identity (new circuit) /// Request a new Tor identity (new circuit)
Future<void> requestNewIdentity() async { Future<void> requestNewIdentity() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_tor.TorApi.requestNewIdentity$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_tor.TorApi.requestNewIdentity$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -457,11 +481,10 @@ class TorApi {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
} }
@@ -475,12 +498,20 @@ abstract class TorLogApi {
/// Called when status changes /// Called when status changes
void onStatusChanged(TorStatus status); void onStatusChanged(TorStatus status);
static void setUp(TorLogApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { static void setUp(
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; TorLogApi? api, {
BinaryMessenger? binaryMessenger,
String messageChannelSuffix = '',
}) {
messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
{ {
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.flutter_tor.TorLogApi.onLogMessage$messageChannelSuffix', pigeonChannelCodec, 'dev.flutter.pigeon.flutter_tor.TorLogApi.onLogMessage$messageChannelSuffix',
binaryMessenger: binaryMessenger); pigeonChannelCodec,
binaryMessenger: binaryMessenger,
);
if (api == null) { if (api == null) {
pigeonVar_channel.setMessageHandler(null); pigeonVar_channel.setMessageHandler(null);
} else { } else {
@@ -492,16 +523,20 @@ abstract class TorLogApi {
return wrapResponse(empty: true); return wrapResponse(empty: true);
} on PlatformException catch (e) { } on PlatformException catch (e) {
return wrapResponse(error: e); return wrapResponse(error: e);
} catch (e) { } catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()),
);
} }
}); });
} }
} }
{ {
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.flutter_tor.TorLogApi.onStatusChanged$messageChannelSuffix', pigeonChannelCodec, 'dev.flutter.pigeon.flutter_tor.TorLogApi.onStatusChanged$messageChannelSuffix',
binaryMessenger: binaryMessenger); pigeonChannelCodec,
binaryMessenger: binaryMessenger,
);
if (api == null) { if (api == null) {
pigeonVar_channel.setMessageHandler(null); pigeonVar_channel.setMessageHandler(null);
} else { } else {
@@ -513,8 +548,10 @@ abstract class TorLogApi {
return wrapResponse(empty: true); return wrapResponse(empty: true);
} on PlatformException catch (e) { } on PlatformException catch (e) {
return wrapResponse(error: e); return wrapResponse(error: e);
} catch (e) { } catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()),
);
} }
}); });
} }
@@ -526,9 +563,13 @@ class IPtProxyController {
/// Constructor for [IPtProxyController]. The [binaryMessenger] named argument is /// Constructor for [IPtProxyController]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
IPtProxyController({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) IPtProxyController({
: pigeonVar_binaryMessenger = binaryMessenger, BinaryMessenger? binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; String messageChannelSuffix = '',
}) : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
@@ -536,39 +577,43 @@ class IPtProxyController {
final String pigeonVar_messageChannelSuffix; final String pigeonVar_messageChannelSuffix;
Future<int> start(TransportType proxyType, String proxy) async { Future<int> start(TransportType proxyType, String proxy) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_tor.IPtProxyController.start$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_tor.IPtProxyController.start$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[proxyType, proxy]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[proxyType, proxy],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as int; return pigeonVar_replyValue! as int;
} }
Future<void> stop(TransportType proxyType) async { Future<void> stop(TransportType proxyType) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.flutter_tor.IPtProxyController.stop$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.flutter_tor.IPtProxyController.stop$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[proxyType]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[proxyType],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
} }
@@ -10,9 +10,9 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting;
Object? _extractReplyValueOrThrow( Object? _extractReplyValueOrThrow(
List<Object?>? replyList, List<Object?>? replyList,
String channelName, { String channelName, {
required bool isNullValid, required bool isNullValid,
}) { }) {
if (replyList == null) { if (replyList == null) {
throw PlatformException( throw PlatformException(
@@ -46,8 +46,9 @@ bool _deepEquals(Object? a, Object? b) {
} }
if (a is List && b is List) { if (a is List && b is List) {
return a.length == b.length && return a.length == b.length &&
a.indexed a.indexed.every(
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]),
);
} }
if (a is Map && b is Map) { if (a is Map && b is Map) {
if (a.length != b.length) { if (a.length != b.length) {
@@ -96,26 +97,20 @@ int _deepHash(Object? value) {
return value.hashCode; return value.hashCode;
} }
class LocalizedResult { class LocalizedResult {
LocalizedResult({ LocalizedResult({required this.languageName, this.countryName});
required this.languageName,
this.countryName,
});
String languageName; String languageName;
String? countryName; String? countryName;
List<Object?> _toList() { List<Object?> _toList() {
return <Object?>[ return <Object?>[languageName, countryName];
languageName,
countryName,
];
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static LocalizedResult decode(Object result) { static LocalizedResult decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -134,7 +129,8 @@ class LocalizedResult {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(languageName, other.languageName) && _deepEquals(countryName, other.countryName); return _deepEquals(languageName, other.languageName) &&
_deepEquals(countryName, other.countryName);
} }
@override @override
@@ -147,7 +143,6 @@ class LocalizedResult {
} }
} }
class _PigeonCodec extends StandardMessageCodec { class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec(); const _PigeonCodec();
@override @override
@@ -155,7 +150,7 @@ class _PigeonCodec extends StandardMessageCodec {
if (value is int) { if (value is int) {
buffer.putUint8(4); buffer.putUint8(4);
buffer.putInt64(value); buffer.putInt64(value);
} else if (value is LocalizedResult) { } else if (value is LocalizedResult) {
buffer.putUint8(129); buffer.putUint8(129);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else { } else {
@@ -178,31 +173,40 @@ class LocaleResolver {
/// Constructor for [LocaleResolver]. The [binaryMessenger] named argument is /// Constructor for [LocaleResolver]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
LocaleResolver({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) LocaleResolver({
: pigeonVar_binaryMessenger = binaryMessenger, BinaryMessenger? binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; String messageChannelSuffix = '',
}) : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
final String pigeonVar_messageChannelSuffix; final String pigeonVar_messageChannelSuffix;
Future<LocalizedResult> resolve(String languageTag, String targetLangouageTag) async { Future<LocalizedResult> resolve(
final pigeonVar_channelName = 'dev.flutter.pigeon.locale_resolver.LocaleResolver.resolve$pigeonVar_messageChannelSuffix'; String languageTag,
String targetLangouageTag,
) async {
final pigeonVar_channelName =
'dev.flutter.pigeon.locale_resolver.LocaleResolver.resolve$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[languageTag, targetLangouageTag]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[languageTag, targetLangouageTag],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as LocalizedResult; return pigeonVar_replyValue! as LocalizedResult;
} }
} }
@@ -10,9 +10,9 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting;
Object? _extractReplyValueOrThrow( Object? _extractReplyValueOrThrow(
List<Object?>? replyList, List<Object?>? replyList,
String channelName, { String channelName, {
required bool isNullValid, required bool isNullValid,
}) { }) {
if (replyList == null) { if (replyList == null) {
throw PlatformException( throw PlatformException(
@@ -34,8 +34,11 @@ Object? _extractReplyValueOrThrow(
return replyList.firstOrNull; return replyList.firstOrNull;
} }
List<Object?> wrapResponse({
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) { Object? result,
PlatformException? error,
bool empty = false,
}) {
if (empty) { if (empty) {
return <Object?>[]; return <Object?>[];
} }
@@ -44,6 +47,7 @@ List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty
} }
return <Object?>[error.code, error.message, error.details]; return <Object?>[error.code, error.message, error.details];
} }
bool _deepEquals(Object? a, Object? b) { bool _deepEquals(Object? a, Object? b) {
if (identical(a, b)) { if (identical(a, b)) {
return true; return true;
@@ -56,8 +60,9 @@ bool _deepEquals(Object? a, Object? b) {
} }
if (a is List && b is List) { if (a is List && b is List) {
return a.length == b.length && return a.length == b.length &&
a.indexed a.indexed.every(
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1])); ((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]),
);
} }
if (a is Map && b is Map) { if (a is Map && b is Map) {
if (a.length != b.length) { if (a.length != b.length) {
@@ -106,7 +111,6 @@ int _deepHash(Object? value) {
return value.hashCode; return value.hashCode;
} }
class Intent { class Intent {
Intent({ Intent({
this.fromPackageName, this.fromPackageName,
@@ -141,7 +145,8 @@ class Intent {
} }
Object encode() { Object encode() {
return _toList(); } return _toList();
}
static Intent decode(Object result) { static Intent decode(Object result) {
result as List<Object?>; result as List<Object?>;
@@ -164,7 +169,12 @@ class Intent {
if (identical(this, other)) { if (identical(this, other)) {
return true; return true;
} }
return _deepEquals(fromPackageName, other.fromPackageName) && _deepEquals(action, other.action) && _deepEquals(data, other.data) && _deepEquals(categories, other.categories) && _deepEquals(mimeType, other.mimeType) && _deepEquals(extra, other.extra); return _deepEquals(fromPackageName, other.fromPackageName) &&
_deepEquals(action, other.action) &&
_deepEquals(data, other.data) &&
_deepEquals(categories, other.categories) &&
_deepEquals(mimeType, other.mimeType) &&
_deepEquals(extra, other.extra);
} }
@override @override
@@ -177,7 +187,6 @@ class Intent {
} }
} }
class _PigeonCodec extends StandardMessageCodec { class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec(); const _PigeonCodec();
@override @override
@@ -185,7 +194,7 @@ class _PigeonCodec extends StandardMessageCodec {
if (value is int) { if (value is int) {
buffer.putUint8(4); buffer.putUint8(4);
buffer.putInt64(value); buffer.putInt64(value);
} else if (value is Intent) { } else if (value is Intent) {
buffer.putUint8(129); buffer.putUint8(129);
writeValue(buffer, value.encode()); writeValue(buffer, value.encode());
} else { } else {
@@ -208,9 +217,13 @@ class IntentHost {
/// Constructor for [IntentHost]. The [binaryMessenger] named argument is /// Constructor for [IntentHost]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
IntentHost({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) IntentHost({
: pigeonVar_binaryMessenger = binaryMessenger, BinaryMessenger? binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; String messageChannelSuffix = '',
}) : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
@@ -222,7 +235,8 @@ class IntentHost {
/// IntentEvents.setUp() was called (cold-start deep links). /// IntentEvents.setUp() was called (cold-start deep links).
/// Returns null if no launch intent is pending. /// Returns null if no launch intent is pending.
Future<Intent?> getInitialIntent() async { Future<Intent?> getInitialIntent() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentHost.getInitialIntent$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.simple_intent_receiver.IntentHost.getInitialIntent$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -232,11 +246,10 @@ class IntentHost {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
return pigeonVar_replyValue as Intent?; return pigeonVar_replyValue as Intent?;
} }
} }
@@ -246,12 +259,20 @@ abstract class IntentEvents {
void onIntentReceived(int sequence, Intent intent); void onIntentReceived(int sequence, Intent intent);
static void setUp(IntentEvents? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { static void setUp(
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; IntentEvents? api, {
BinaryMessenger? binaryMessenger,
String messageChannelSuffix = '',
}) {
messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
{ {
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived$messageChannelSuffix', pigeonChannelCodec, 'dev.flutter.pigeon.simple_intent_receiver.IntentEvents.onIntentReceived$messageChannelSuffix',
binaryMessenger: binaryMessenger); pigeonChannelCodec,
binaryMessenger: binaryMessenger,
);
if (api == null) { if (api == null) {
pigeonVar_channel.setMessageHandler(null); pigeonVar_channel.setMessageHandler(null);
} else { } else {
@@ -264,8 +285,10 @@ abstract class IntentEvents {
return wrapResponse(empty: true); return wrapResponse(empty: true);
} on PlatformException catch (e) { } on PlatformException catch (e) {
return wrapResponse(error: e); return wrapResponse(error: e);
} catch (e) { } catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()),
);
} }
}); });
} }
@@ -277,9 +300,13 @@ class IntentGatekeeperHostApi {
/// Constructor for [IntentGatekeeperHostApi]. The [binaryMessenger] named argument is /// Constructor for [IntentGatekeeperHostApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
IntentGatekeeperHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) IntentGatekeeperHostApi({
: pigeonVar_binaryMessenger = binaryMessenger, BinaryMessenger? binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; String messageChannelSuffix = '',
}) : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
@@ -289,21 +316,23 @@ class IntentGatekeeperHostApi {
/// Replicates the blocked-packages policy to the native side so the /// Replicates the blocked-packages policy to the native side so the
/// [IntentReceiverActivity] can reject intents without launching Flutter. /// [IntentReceiverActivity] can reject intents without launching Flutter.
Future<void> setConfig(bool enabled, List<String> blockedPackages) async { Future<void> setConfig(bool enabled, List<String> blockedPackages) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.setConfig$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.setConfig$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[enabled, blockedPackages]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[enabled, blockedPackages],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
/// Replicates whether the Custom Tabs feature is enabled to the native side. /// Replicates whether the Custom Tabs feature is enabled to the native side.
@@ -311,42 +340,46 @@ class IntentGatekeeperHostApi {
/// share-with-URL intents to the main browser instead of launching the /// share-with-URL intents to the main browser instead of launching the
/// stripped-down custom-tab activity. Defaults to enabled on the native side. /// stripped-down custom-tab activity. Defaults to enabled on the native side.
Future<void> setCustomTabsEnabled(bool enabled) async { Future<void> setCustomTabsEnabled(bool enabled) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.setCustomTabsEnabled$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.setCustomTabsEnabled$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[enabled]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[enabled],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
/// Resolves a package name to its user-visible application label via /// Resolves a package name to its user-visible application label via
/// [PackageManager]. Returns `null` if the package is not installed or the /// [PackageManager]. Returns `null` if the package is not installed or the
/// label cannot be resolved. /// label cannot be resolved.
Future<String?> resolvePackageLabel(String packageName) async { Future<String?> resolvePackageLabel(String packageName) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.resolvePackageLabel$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.resolvePackageLabel$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[packageName]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[packageName],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
return pigeonVar_replyValue as String?; return pigeonVar_replyValue as String?;
} }
@@ -356,7 +389,8 @@ class IntentGatekeeperHostApi {
/// [ackPendingAlwaysAllows] after Flutter settings were updated /// [ackPendingAlwaysAllows] after Flutter settings were updated
/// successfully. /// successfully.
Future<List<String>> getPendingAlwaysAllows() async { Future<List<String>> getPendingAlwaysAllows() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.getPendingAlwaysAllows$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.getPendingAlwaysAllows$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
@@ -366,31 +400,32 @@ class IntentGatekeeperHostApi {
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return (pigeonVar_replyValue! as List<Object?>).cast<String>(); return (pigeonVar_replyValue! as List<Object?>).cast<String>();
} }
/// Removes the given packages from the pending "Always allow" set after /// Removes the given packages from the pending "Always allow" set after
/// Flutter has successfully persisted them into its own policy store. /// Flutter has successfully persisted them into its own policy store.
Future<void> ackPendingAlwaysAllows(List<String> packageNames) async { Future<void> ackPendingAlwaysAllows(List<String> packageNames) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.ackPendingAlwaysAllows$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.simple_intent_receiver.IntentGatekeeperHostApi.ackPendingAlwaysAllows$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[packageNames]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[packageNames],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
_extractReplyValueOrThrow( _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: true, isNullValid: true,
) );
;
} }
} }
@@ -10,9 +10,9 @@ import 'package:flutter/services.dart';
import 'package:meta/meta.dart' show immutable, protected, visibleForTesting; import 'package:meta/meta.dart' show immutable, protected, visibleForTesting;
Object? _extractReplyValueOrThrow( Object? _extractReplyValueOrThrow(
List<Object?>? replyList, List<Object?>? replyList,
String channelName, { String channelName, {
required bool isNullValid, required bool isNullValid,
}) { }) {
if (replyList == null) { if (replyList == null) {
throw PlatformException( throw PlatformException(
@@ -34,8 +34,11 @@ Object? _extractReplyValueOrThrow(
return replyList.firstOrNull; return replyList.firstOrNull;
} }
List<Object?> wrapResponse({
List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) { Object? result,
PlatformException? error,
bool empty = false,
}) {
if (empty) { if (empty) {
return <Object?>[]; return <Object?>[];
} }
@@ -45,7 +48,6 @@ List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty
return <Object?>[error.code, error.message, error.details]; return <Object?>[error.code, error.message, error.details];
} }
class _PigeonCodec extends StandardMessageCodec { class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec(); const _PigeonCodec();
@override @override
@@ -72,9 +74,13 @@ class SpeechToTextApi {
/// Constructor for [SpeechToTextApi]. The [binaryMessenger] named argument is /// Constructor for [SpeechToTextApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default /// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform. /// BinaryMessenger will be used which routes to the host platform.
SpeechToTextApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) SpeechToTextApi({
: pigeonVar_binaryMessenger = binaryMessenger, BinaryMessenger? binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; String messageChannelSuffix = '',
}) : pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
final BinaryMessenger? pigeonVar_binaryMessenger; final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec(); static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
@@ -89,21 +95,23 @@ class SpeechToTextApi {
/// The [locale] parameter specifies the language locale for recognition /// The [locale] parameter specifies the language locale for recognition
/// (e.g., 'en-US', 'de-DE'). If null, uses the device default. /// (e.g., 'en-US', 'de-DE'). If null, uses the device default.
Future<bool> showDialog({String? locale}) async { Future<bool> showDialog({String? locale}) async {
final pigeonVar_channelName = 'dev.flutter.pigeon.speech_to_text_dialog.SpeechToTextApi.showDialog$pigeonVar_messageChannelSuffix'; final pigeonVar_channelName =
'dev.flutter.pigeon.speech_to_text_dialog.SpeechToTextApi.showDialog$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName, pigeonVar_channelName,
pigeonChannelCodec, pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger, binaryMessenger: pigeonVar_binaryMessenger,
); );
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[locale]); final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
<Object?>[locale],
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?; final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList, pigeonVar_replyList,
pigeonVar_channelName, pigeonVar_channelName,
isNullValid: false, isNullValid: false,
) );
;
return pigeonVar_replyValue! as bool; return pigeonVar_replyValue! as bool;
} }
} }
@@ -118,12 +126,20 @@ abstract class SpeechToTextEvents {
/// recognition failed or was cancelled. /// recognition failed or was cancelled.
void onTextReceived(String text); void onTextReceived(String text);
static void setUp(SpeechToTextEvents? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) { static void setUp(
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; SpeechToTextEvents? api, {
BinaryMessenger? binaryMessenger,
String messageChannelSuffix = '',
}) {
messageChannelSuffix = messageChannelSuffix.isNotEmpty
? '.$messageChannelSuffix'
: '';
{ {
final pigeonVar_channel = BasicMessageChannel<Object?>( final pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.speech_to_text_dialog.SpeechToTextEvents.onTextReceived$messageChannelSuffix', pigeonChannelCodec, 'dev.flutter.pigeon.speech_to_text_dialog.SpeechToTextEvents.onTextReceived$messageChannelSuffix',
binaryMessenger: binaryMessenger); pigeonChannelCodec,
binaryMessenger: binaryMessenger,
);
if (api == null) { if (api == null) {
pigeonVar_channel.setMessageHandler(null); pigeonVar_channel.setMessageHandler(null);
} else { } else {
@@ -135,8 +151,10 @@ abstract class SpeechToTextEvents {
return wrapResponse(empty: true); return wrapResponse(empty: true);
} on PlatformException catch (e) { } on PlatformException catch (e) {
return wrapResponse(error: e); return wrapResponse(error: e);
} catch (e) { } catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString())); return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()),
);
} }
}); });
} }