Platform-conditional bridge for platform_detect. On web, re-exports operatingSystem (browser detection). On native, provides a stub that throws.
package:platform_detect only works on web — it uses dart:html to read the browser's user agent. Importing it directly on native would break compilation.
This package uses conditional exports:
- Web: re-exports
platform_detect—operatingSystemreturns the browser's OS string - Native: provides a stub
operatingSystemgetter that throwsUnimplementedError
Code can import operatingSystem unconditionally without worrying about the target platform.
import 'package:fz_web_platform_impl/fz_web_platform_impl.dart';
void checkPlatform() {
try {
final os = operatingSystem; // works on web, throws on native
print(os);
} on UnimplementedError {
// running on native
}
}Internal utility — rarely used directly.