Flutter Future returning instance of future


I am making an api call to receive data. When I make the call, I get back an instance of future. Why does this still return an instance of future instead of waiting for the data?

Here is my networking file

class NetworkHelper {

  final String url;

Future getSecureData(String token) async {
    http.Response response = await http.post(
      headers: {
        HttpHeaders.authorizationHeader: token,
    var data = response;
    return data;

Here is my Account Settings file

class AccountSettings extends StatefulWidget {
  const AccountSettings({Key? key}) : super(key: key);
  static const String id = 'account_settings';

  State<AccountSettings> createState() => _AccountSettingsState();

class _AccountSettingsState extends State<AccountSettings> {
  var userData;

  void initState() {


  Future getUserData() async {
    var token = await SecureStorage.getAccessToken();
    var jwttoken = 'JWT ' + token!;
    NetworkHelper networkHelper =
    userData = await networkHelper.getSecureData(jwttoken);

  Widget build(BuildContext context) {
    return Scaffold(


Your getSecureData method is returning a Future with no type associated, so try including a type to the the Future such as

Future<SomeType> getSecureData() async {

Answered By – Pheepster

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published