-2

For UI that should differ slightly on iOS and Android, ?

Saron Tan
  • 23
  • 7

3 Answers3

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
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