diff --git a/packages/shorebird_cli/lib/src/validators/macos_network_entitlement_validator.dart b/packages/shorebird_cli/lib/src/validators/macos_network_entitlement_validator.dart index 2831fc3b6..09467a5cf 100644 --- a/packages/shorebird_cli/lib/src/validators/macos_network_entitlement_validator.dart +++ b/packages/shorebird_cli/lib/src/validators/macos_network_entitlement_validator.dart @@ -48,8 +48,13 @@ class MacosNetworkEntitlementValidator extends Validator { String get description => 'macOS app has Outgoing Connections entitlement'; @override - bool canRunInCurrentContext() => - _macosDirectory != null && _macosDirectory!.existsSync(); + bool canRunInCurrentContext() => _macosDirectory?.existsSync() ?? false; + + @override + String? get incorrectContextMessage => ''' +The ${_macosDirectory?.path ?? 'macos'} directory does not exist. + +The command you are running must be run within a Flutter app project that supports the macOS platform.'''; @override Future> validate() async { diff --git a/packages/shorebird_cli/test/src/validators/macos_network_entitlement_validator_test.dart b/packages/shorebird_cli/test/src/validators/macos_network_entitlement_validator_test.dart index 7468bec91..b4ce6f838 100644 --- a/packages/shorebird_cli/test/src/validators/macos_network_entitlement_validator_test.dart +++ b/packages/shorebird_cli/test/src/validators/macos_network_entitlement_validator_test.dart @@ -100,6 +100,12 @@ void main() { runWithOverrides(() => validator.canRunInCurrentContext()), isFalse, ); + expect( + runWithOverrides(() => validator.incorrectContextMessage), + contains( + '''The command you are running must be run within a Flutter app project that supports the macOS platform.''', + ), + ); }); }); });