You may encounter this issue when you try to run for Flutter web application.
Normal iOS and Android platforms are not recognized on Flutter typical mobile app. If you want to run them both on iOS, Android and Flutter Web, you need to change the package. In general, your error looks like below

To get rid of this issue we need to install universal_io package. This package would convert the platform dependencies to all the platform of Flutter apps.
flutter pub add universal_io
And you may need to do the below

Once you make the above changes, you are good to go. You see I have commented out dart:io on line 6 and added universal_io/io.dart on line 7.
Now, run your code, you should have no problem.