Flutter - How to write platform dependent code


Is it possible to write seperate if else blocks for ios and android in flutter dart files?

1 Answer

4 years ago by

We have 'dart:io' for get platform type

 import 'dart:io' show Platform;

if (Platform.isAndroid) {
   // Do your styling
  } else if (Platform.isIOS) {
    // Do your styling
  }
4 years ago by Omnitrix