Flutter doc suggest to use Platform.iOS inside views and defaultTargetPlatform for API.
This allow use to override defaultTargetPlatform on unit test and manage Platform through context inside widget testing.
// Change this
Platform.isIOS
// To this
defaultTargetPlatform == TargetPlatform.iOS
Flutter doc suggest to use Platform.iOS inside views and defaultTargetPlatform for API. This allow use to override defaultTargetPlatform on unit test and manage Platform through context inside widget testing.
https://api.flutter.dev/flutter/foundation/defaultTargetPlatform.html