flutter check target platform code example
Example 1: check if is android flutter
import 'dart:io' show Platform;
if (Platform.isAndroid) {
// Android-specific code
} else if (Platform.isIOS) {
// iOS-specific code
}
Example 2: flutter check ios or android
bool isIOS = Theme.of(context).platform == TargetPlatform.iOS;
bool isAndroid = Theme.of(context).platform == TargetPlatform.android;