You may use conditional import:
import 'some_package_stub.dart'
if (dart.library.io) 'some_package_io.dart'
if (dart.library.html) 'some_package_web.dart';
some_package_stub.dart file is required to avoid error while developing and compiling. It must contains some stub functionality which depends on running platform.
For example if you use function getPlatformDependedData from package some_package which returns different data under Web or Android, than you should declare the prototype of those function ins some_package_stub.dart:
String getPlatformDependedData() {
throw UnimplementedError('This error will not raised!');
}
Then in the code you can use isWeb constant to check if code is web related:
if (isWeb) {
// some web related statements
}