0

When I use the CookieManager function of dio_cookie_manager plugin into the page of included flutter_inappwebview plugin, I got the errors:

The argument type 'CookieManager' can't be assigned to the parameter type 'interceptors'

and

'CookieManager' isn't a function.

How can I use both plugins with separate Cookiemanager?

wahid anvary
  • 392
  • 3
  • 11

1 Answers1

1

to avoid such conflicts, make sure that you use import '...' as customName.
For example;

import 'package:dio/dio.dart';
import 'package:dio_cookie_manager/cookie_manager.dart' as dioCookieManager;
import 'package:cookie_jar/cookie_jar.dart';

in that case, you can use it like

var dio =  Dio();
  var cookieJar = CookieJar();
  dio.interceptors.add(dioCookieManager.CookieManager(cookieJar));
// ...

so you can avoid conflicts with other packages as well.

Yilmaz Guleryuz
  • 9,313
  • 3
  • 32
  • 43