I using dart_meteor package
and it must be initiated in global scope main.dart
like this
import 'package:flutter/material.dart';
import 'package:dart_meteor/dart_meteor.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
Future getUrl2() async {
Uri myUrl = Uri.http('myurl.id', '/geturl.php');
try {
http.Response response = await http.get(myUrl );
return response.body;
} catch (e) {
throw (e);
}
}
MeteorClient meteor = MeteorClient.connect(url: getUrl());
getUrl() async {
String url = await getUrl2();
return url;
}
void main() {
runApp(const MyApp());
}
and it got error:
_TypeError (type 'Future<dynamic>' is not a subtype of type 'String')
from the documentation this package https://pub.dev/packages/dart_meteor must be
First, create an instance of MeteorClient in your app global scope so that it can be used anywhere in your project.
I need to call to server using static api, about newest version url
but I got error like this
so how to await http call (or synced http call) in main dart?