I'm successfully logging into Facebook with Flutter using the flutter_facebook_auth package and now I'm having trouble getting my user profile info in the getUserData method map. Here is my code....
var userData = await FacebookAuth.instance.getUserData();
Map<String, dynamic> _userData;
_userData = userData;
var info = _userData['items'];
String facebookName;
for (var items in info) {
Map myMap = items; //store each map
var name = (myMap['name'] as Map).toString();
facebookName = name;
}
When trying to print facebookName, I get the following error...
The getter 'iterator' was called on null.
I'm not sure exactly where I'm getting this wrong. Please help!
Printing _userData give the following desired map...
flutter: {email: , id: , picture: {data: {is_silhouette: false, height: 122, url: , width: 200}}, name: Charles Cleveland Jr.}
_userDatavariable ? - dm_tr