flutter 判断是否是web环境
代码如下
import 'package:flutter/foundation.dart' show kIsWeb;void main() {if (kIsWeb) {print('Running on the web!');} else {print('Not running on the web!');}
}
如果是使用
Platform.isAndroid 会报错 所以使用上面的方式
代码如下
import 'package:flutter/foundation.dart' show kIsWeb;void main() {if (kIsWeb) {print('Running on the web!');} else {print('Not running on the web!');}
}
如果是使用
Platform.isAndroid 会报错 所以使用上面的方式