flutter_device_preview
flutter_device_preview copied to clipboard
this package is not working in flutter 2.5.10
Same here, not working in Flutter version 2.10.5. Logcat shown as below:
flutter_sdk/default/.pub-cache/hosted/pub.dartlang.org/device_preview-1.1.0/lib/src/device_preview.dart:217:45: Error: Property 'window' cannot be accessed on 'WidgetsBinding?' because it is potentially null.
[ ] [ +2 ms] - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../development/flutter_sdk/default/packages/flutter/lib/src/widgets/binding.dart').
[ ] [ ] Try accessing using ?. instead.
[ ] [ ] orElse: () => WidgetsBinding.instance.window.locale,
[ ] [ ] ^^^^^^
Any update?
Not Working Same Issue
Have you guys tried fixing the error by editing device_preview.dart?
I don't face the same issue, but I'm running 3.0.5 and not 2.5.10. My dev/main branches work fine on iPhone, Mac & Web. I've made a special branch just with this fix on top of the latest master branch from this flutter_device_preview repo.
While I'm not sure whether my fix works, give it a try and let me know:
dependencies:
...your other plugins here...
device_preview:
git:
url: https://github.com/BrutalCoding/runtime_inspector
ref: flutter_device_preview/master
path: device_preview/
I'll submit a fix to this original repo if it works.
There is a temporary method. How to remove ^ from the version of the package.
device_preview: 1.0.0
I have made updates for compatibility and released a new package. This is for sharing, not for promotional purposes. I hope it doesn't hinder any discussions.
Package: device_preview_minus