alann-maulana / flutter_beacon

An hybrid iBeacon scanner and transmitter SDK for Flutter Android and iOS.
Apache License 2.0
118 stars 147 forks source link

Put major in a variable #13

Closed MelissaCOURLA closed 5 years ago

MelissaCOURLA commented 5 years ago

Hi, I try to create a variable like this final _major = result.beacons[].major but I don't understand what is an index of desired beacon. I try this line final _major = result.beacons[].major I try add this line with other variable class _MyAppState extends State { StreamSubscription _streamRanging; final _beacons = []; final _major = result.beacons[].major; .... } but there are an issue with result which does not existe I try add my line in _streamRanging = flutterBeacon.ranging(regions).listen ((result) { result.beacons.forEach ((b) { final _major = result.beacons[].major; print(b.major); _beacons.sort(_compareParameters); monid =b.major; print('monid='); print(monid); return b.major; } ); } ); with this code the issue is "The argument type 'List' can't be assigned to the parameter type 'int'" my goal it's take the major and put it in a variable. But I am a beginner in flutter , can you help please

alann-maulana commented 5 years ago

Hi @MelissaCOURLA

For ranging result, beacons is a List of Beacon's object. You need to learn about how to get data from a list by referring to List class docs here.

MelissaCOURLA commented 5 years ago

than for your answer