For UI that should differ slightly on iOS and Android, ?
Asked
Active
Viewed 2,032 times
-2
-
https://stackoverflow.com/q/45924474/15045793 as it is question – nagendra nag Mar 07 '22 at 07:06
-
https://stackoverflow.com/a/50744481/10202281 – Ganesh Bhat Mar 07 '22 at 07:06
3 Answers
3
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

Aayush Kedawat
- 31
- 1
2
import 'dart:io' show Platform;
Now you can detect the platform by just doing
Platform.isIOS // for ios
Platform.isAndroid //for android

Muhammad Atif Akram
- 1,204
- 1
- 4
- 12
1
import 'dart:io' show Platform;
if (Platform.isAndroid) {
// Android-specific code
} else if (Platform.isIOS) {
// iOS-specific code
}

Saron Tan
- 23
- 7