TestPlatform.fromPlatform constructor
Creates a TestPlatform with the same properties as platform.
Implementation
@visibleForTesting
factory TestPlatform.fromPlatform(Platform platform) {
// There is currently no way to have a platform with both
// a browser platform and a native platform.
var native = platform.nativePlatform;
if (native != null) return TestPlatform.fromNative(native);
var browser = platform.browserPlatform;
if (browser != null) return TestPlatform.fromBrowser(browser);
return const TestPlatform.unknown();
}