updated setOptions and getOptions deprecated methods

This commit is contained in:
Lorenzo Pichilli 2022-04-22 13:43:25 +02:00
parent 3ef7d1949d
commit 40140e50e1
1 changed files with 4 additions and 7 deletions

View File

@ -1847,19 +1847,16 @@ class InAppWebViewController
///Use [setSettings] instead. ///Use [setSettings] instead.
@Deprecated('Use setSettings instead') @Deprecated('Use setSettings instead')
Future<void> setOptions({required InAppWebViewGroupOptions options}) async { Future<void> setOptions({required InAppWebViewGroupOptions options}) async {
Map<String, dynamic> args = <String, dynamic>{}; InAppWebViewSettings settings = InAppWebViewSettings.fromMap(options.toMap());
await setSettings(settings: settings);
args.putIfAbsent('settings', () => options.toMap());
await _channel.invokeMethod('setSettings', args);
} }
///Use [getSettings] instead. ///Use [getSettings] instead.
@Deprecated('Use getSettings instead') @Deprecated('Use getSettings instead')
Future<InAppWebViewGroupOptions?> getOptions() async { Future<InAppWebViewGroupOptions?> getOptions() async {
Map<String, dynamic> args = <String, dynamic>{}; InAppWebViewSettings? settings = await getSettings();
Map<dynamic, dynamic>? options = Map<dynamic, dynamic>? options = settings?.toMap();
await _channel.invokeMethod('getSettings', args);
if (options != null) { if (options != null) {
options = options.cast<String, dynamic>(); options = options.cast<String, dynamic>();
return InAppWebViewGroupOptions.fromMap(options as Map<String, dynamic>); return InAppWebViewGroupOptions.fromMap(options as Map<String, dynamic>);