Q:

Cannot communicate with global variables in async functions in Flutter

I'm working in Flutter and I'm having a problem with communicating with the rest of my program from inside an asynchronous function.  In specific I'm using an http request (which HAS to be an asynchronous function, so that's not an option to do differently) and trying to (after the async has completed) SET a previously instantiated global variable equal to the part of the response from the http request.  
In order to try and parse down the issue, I created a minimal-code example from the basic flutter project.
Code Example to follow.
String username = 'xxx';
String password = 'xxx';
String basicAuth = 'Basic ' + base64Encode(utf8.encode('$username:$password'));
String url = 'xxx';
String user_phone = '5555555555';
String locationId1 = 'xxx';
String locationId2 = 'xxx';
Map info;

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(

        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(

        title: Text(widget.title),
      ),
      body: Center(

        child: Column(

          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'Session ID:',
            ),
            Text(
              '$sessionID',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: createSessionID,
        tooltip: 'Create Session ID',
        child: Icon(Icons.add),
      ), 
    );
  }
}

Future<void> createSessionID() async {

  http.Response response = await http.post(
    url,
    headers: <String, String>{'authorization': basicAuth},
    body: {'user_phone': user_phone, 'locationId1': locationId1, 'locationId2': locationId2},

  );
  info  = jsonDecode(response.body);
  sessionID = info['session_id'];
  print (info['session_id']);
  return info;
}

Effectively the issue is that I can PRINT the values to the debug console inside the async function, BUT if I try to set that global Map variable to anything, it is constantly null, and never set.
I've tried setting it as a Future  and returning the variable, but that doesn't change the fact that it's still not being set properly, as it returns a null for some unknown reason.
So in the above example if I change it to a:
Future<Map> createTrip() async { 
  <Same Code, but with 

  Map data = jsonDecode(response.body);
  return data;

  > 
}

<void> updateInfo() async {
  info = await createSessionID();
}

And then print the values inside info, it still tells me the same thing, that info itself is null.  Ergo it's never being set from inside the asynchronous function.  And I just don't understand why.
Thoughts?  Ideas?  
(Edited Twice to add original code, and clear up confusion) 

A:

So the issue here, was that I didn't properly understand the concept of a Future.  (And honestly, I probably still don't, lol).
So I thought that if you would await a response, it would automatically change a Future of a variable-type into a variable of the type it was supposed to be.
That...  Doesn't happen.
So instead, you need to communicate with the different parts of your program in a different way.  The solution I eventually used (Likely not the best, but it works, so shrug good enough for me) was to use Global variables to store the information, then use getters to set the local variable my program needs equal the global variable that the server-call was used to set.
So an example of this:
Map data;  // Set globally, outside the function;

Future<void> createTrip() {
  // Code for server call
  data = jsonDecode(response.body);
  return;
}

Map getData () {
  return data;
}

Thus, the issue of trying to return a future, and decode it is avoided entirely.  Again, this is likely highly inefficient, I assume there are better ways to do it...  But at least it works, lol.

