feat: replace Platform.isX with defaultTargetPlatform#1446
Conversation
Isn't that the case here? |
Where exactly do you mean? Building the AndroidContext or converting to json doesn't call any native platform methods. So it's not critical in my opinion. Further we cannot mock the platform to test these methods without an integration test, which should not be needed in many cases. See this test which has different outcomes for different platforms, but is not needed to be executed on an according device / emulator. |
Alright, sounds good then. :) |
Description
Flutter recommends using
defaultTargetPlatforminstead ofPlatform.isX, where possible. This also enables testing platform specific dart code in unit tests (but without native code), which is way more convenient and faster.Checklist
fix:,feat:,docs:,chore:etc).///, where necessary.Breaking Change