gskinnerTeam / flutter-universal-platform

A web-safe implementation of dart.io.Platforms. Helps avoid the "Unsupported operation: Platform._operatingSystem" runtime error.
MIT License
108 stars 29 forks source link

Force a platform type when testing #15

Open martin-robert-fink opened 3 years ago

martin-robert-fink commented 3 years ago

When running tests, either using variant: TargetPlatformVariant.mobile() or debugDefaultTargetPlatformOverride does not cooperate with UniversalPlatform.

Can you add a method, something like testUniversalPlatformOverride = targetPlatformType to set a platform type for widget testing. Or, perhaps create something that extends from the TestVariant class that could be used.

jeroen-meijer commented 2 years ago

I would love this as well. This is an extremely useful package, but the lack of testing mechanisms makes it quite hard to use in some cases, which might persuade people to not use the package as a result.