flutter_device_preview icon indicating copy to clipboard operation
flutter_device_preview copied to clipboard

this package is not working in flutter 2.5.10

Open guman24 opened this issue 3 years ago • 6 comments
trafficstars

guman24 avatar Jun 01 '22 19:06 guman24

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,
[        ] [        ]                                             ^^^^^^

dungphanpm avatar Jun 20 '22 14:06 dungphanpm

Any update?

daniel-forsdike avatar Jun 29 '22 22:06 daniel-forsdike

Not Working Same Issue

Kishan7up avatar Aug 01 '22 04:08 Kishan7up

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.

BrutalCoding avatar Aug 06 '22 17:08 BrutalCoding

There is a temporary method. How to remove ^ from the version of the package.

device_preview: 1.0.0

cyb9701 avatar Aug 16 '22 05:08 cyb9701

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

rbdog avatar Jul 27 '23 06:07 rbdog