Dart Future API 3
import 'dart:async';
const data = "I'm expansive data";
// Future with String data is being returned.
// This function returns the instance of
// Future and not the actual data.
Future<String> makeDataCall() async {
var data = await getData();
throw Exception("Error occurred in making data call");
}
String getData() {
return data;
}
void main() {
var theFurture = makeDataCall();
theFurture.then((value) {
print(value);
}).catchError((error){
print(error);
});
}