Reputation: 23
For UI that should differ slightly on iOS and Android, ?
Upvotes: -2
Views: 3920
Reputation: 41
import 'dart:io' show Platform;
Now, you need to check whether you are on Web or Application.
if(kIsWeb) {
Enter Web specific code here
} else {
if(Platform.isIOS){
Enter IOS specific code here.
} else if (Platform.isAndroid){
Enter Android specific code here.
}
}
Platform has following options:
Platform.isAndroid
Platform.isFuchsia
Platform.isIOS
Platform.isLinux
Platform.isMacOS
Platform.isWindows
Upvotes: 4
Reputation: 1315
import 'dart:io' show Platform;
Now you can detect the platform by just doing
Platform.isIOS // for ios
Platform.isAndroid //for android
Upvotes: 4
Reputation: 23
import 'dart:io' show Platform;
if (Platform.isAndroid) {
// Android-specific code
} else if (Platform.isIOS) {
// iOS-specific code
}
Upvotes: 1