Skip to content

Commit

Permalink
fix: removing the need for dart:io in feature system where current pl…
Browse files Browse the repository at this point in the history
…atform was being checked using Platform instead of TargetPlatform
  • Loading branch information
pavanpodila committed Sep 18, 2024
1 parent 035376b commit 0e00368
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:vyuh_core/vyuh_core.dart';
import 'package:vyuh_extension_content/content/condition.dart';

Expand All @@ -21,20 +19,23 @@ final class CurrentPlatform extends ConditionConfiguration {
return Future.value('web');
}

if (Platform.isAndroid) {
return Future.value('android');
} else if (Platform.isIOS) {
return Future.value('ios');
} else if (Platform.isMacOS) {
return Future.value('macos');
} else if (Platform.isWindows) {
return Future.value('windows');
} else if (Platform.isLinux) {
return Future.value('linux');
} else if (Platform.isFuchsia) {
return Future.value('fuchsia');
} else {
return Future.value(null);
final platform = Theme.of(context).platform;

switch (platform) {
case TargetPlatform.android:
return Future.value('android');
case TargetPlatform.iOS:
return Future.value('ios');
case TargetPlatform.macOS:
return Future.value('macos');
case TargetPlatform.windows:
return Future.value('windows');
case TargetPlatform.linux:
return Future.value('linux');
case TargetPlatform.fuchsia:
return Future.value('fuchsia');
default:
return Future.value(null);
}
}
}

0 comments on commit 0e00368

Please sign in to comment.