I recently added Web support to an existing mobile Flutter app and got this error when running it in Chrome:

Caught error: Unsupported operation: Platform._operatingSystem

It turns out it is a known issue in Flutter Web, from July 2019: https://github.com/flutter/flutter/issues/36126. If you use platform.isAndroid or platform.isIOS, it'll throw an exception.

The fix is to use their kIsWeb constant workaround:

import 'package:flutter/foundation.dart' show kIsWeb;


if (!kIsWeb && Platform.isAndroid) {