It is simple just import the io library
import'dart:io' show Platform;
void main(){
if(Platform.isIOS){
return someThing();
}else if(Platform.isAndroid){
return otherThing();
}else if(Platform.isMacOS){
return anotherThing();
}
or in very simple way
Platform.isIOS ? someThing() : anOther(),