Skip to content

Commit

Permalink
refactor(bonsoir): Ran dart format.
Browse files Browse the repository at this point in the history
Closes #76.
  • Loading branch information
Skyost committed Jan 8, 2024
1 parent 9696cc2 commit 41360b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/bonsoir/lib/src/broadcast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class BonsoirBroadcast extends BonsoirActionHandler<BonsoirBroadcastEvent> {
bool printLogs = kDebugMode,
required this.service,
}) : super(
action: BonsoirPlatformInterface.instance.createBroadcastAction(service, printLogs: printLogs),
action: BonsoirPlatformInterface.instance.createBroadcastAction(
service,
printLogs: printLogs,
),
);
}
19 changes: 15 additions & 4 deletions packages/bonsoir/lib/src/discovery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ class BonsoirDiscovery extends BonsoirActionHandler<BonsoirDiscoveryEvent> {
required this.type,
required this.serviceResolver,
required super.action,
}) : assert(type == BonsoirServiceNormalizer.normalizeType(type), 'The provided type "$type" is invalid.');
}) : assert(
type == BonsoirServiceNormalizer.normalizeType(type),
'The provided type "$type" is invalid.',
);

/// Creates a new Bonsoir discovery instance.
factory BonsoirDiscovery({
bool printLogs = kDebugMode,
required String type,
ServiceResolver? serviceResolver,
}) {
BonsoirAction<BonsoirDiscoveryEvent> action = BonsoirPlatformInterface.instance.createDiscoveryAction(type, printLogs: printLogs);
serviceResolver ??= action is ServiceResolver ? (action as ServiceResolver) : _NoServiceResolver();
BonsoirAction<BonsoirDiscoveryEvent> action =
BonsoirPlatformInterface.instance.createDiscoveryAction(
type,
printLogs: printLogs,
);
serviceResolver ??= action is ServiceResolver
? (action as ServiceResolver)
: _NoServiceResolver();
return BonsoirDiscovery._internal(
type: type,
serviceResolver: serviceResolver,
Expand All @@ -37,6 +46,8 @@ class BonsoirDiscovery extends BonsoirActionHandler<BonsoirDiscoveryEvent> {
class _NoServiceResolver with ServiceResolver {
@override
Future<void> resolveService(BonsoirService service) {
throw UnimplementedError('No service resolver provided. Please ensure either you or your current platform interface provide one !');
throw UnimplementedError(
'No service resolver provided. Please ensure either you or your current platform interface provide one !',
);
}
}

0 comments on commit 41360b6

Please sign in to comment.