Fixes https://github.com/flutter/flutter/issues/131511 Similar fix to https://github.com/flutter/flutter/commit/84c8abd0f6776455e91e9c375c7d7ed8f3291e75#diff-38f3e3415d9806f22a78060fafb3206d1a006f74631fac04e7a680a64e06ccf0