reload method
Hot reloads the app through the Flutter tool that launched it.
Implementation
Future<Duration> reload({
Duration timeout = const Duration(seconds: 60),
}) async {
final String? method = await toolServiceMethod('reloadSources');
if (method == null) {
throw LiveCommandException(
'Hot reload isn\'t available. The app needs to still be attached to '
'`flutter run` or your IDE.',
);
}
final Stopwatch stopwatch = Stopwatch()..start();
final Object? result = await client.call(method, {
'isolateId': isolateId,
}, timeout);
if (result is Map && result['success'] == false) {
throw LiveCommandException('Hot reload failed: ${jsonEncode(result)}');
}
return stopwatch.elapsed;
}