presentation-displays icon indicating copy to clipboard operation
presentation-displays copied to clipboard

Error when getDisplays

Open dariocf1 opened this issue 3 years ago • 2 comments

When getDisplays is called a error is throwed: type 'Null' is not a subtype of type 'int'

  • Device: Android Tablet
  • Version 7.1.2

try { final values = await displayManager.getDisplays(); print(values); } catch (error) { print(error); }

The _displayMethodChannel?.invokeMethod returns: [{a: 0, b: 3, c: 0, d: Built-in Screen}, {a: 1, b: 11, c: 0, d: HDMI Screen}]

But the displayFromJson expects a json with "displayId", "flags", "name", "rotation", instead receives "a", "b", "c", "d" fields.

dariocf1 avatar Jun 24 '21 01:06 dariocf1

hi, I fixed this issue by using klutzy way haha, try this https://github.com/arbyazra123/presentation-displays, I changed the parameter in native android to a = displayId, b = flags, c = rotation, d = displayName

arbyazra123 avatar Aug 26 '21 14:08 arbyazra123

I have solved & Added Custom Methods Go & check https://github.com/MUSA-19542/FlutterCustom/tree/main

MUSA-19542 avatar Aug 10 '24 21:08 MUSA-19542