In my project , my flutter module need to fetch some information from native with MethodChannel.
And I want this method channel call is returned before even the root widget display (because this widget will use this information to fetch data and display)
I have tried invoking before runApp in main(). but this call seems too early to work . And I don't know whether is a bad idea to make main async
Any other better way to do this kind of work?
void main() async{
WidgetsFlutterBinding.ensureInitialized();
MethodChannel platform = const MethodChannel('flutter.km.methodchannel');
var nativeInfo = await platform.invokeMethod('getNativeInfo');
runApp(const MyApp());
}