Flutter api persists the cookies in files, custom X-CSRF-TOKEN, csrf-cookie, XSRF-TOKEN

pubspec.yaml

  dio: ^3.0.10
dio_cookie_manager: ^1.0.0
path_provider: ^1.6.27
cookie_jar: ^1.0.1

Init dio

final Dio dio = Dio();
PersistCookieJar cookieJar;
Api() {
if (!kReleaseMode) {
dio.interceptors
.add(LogInterceptor(responseBody: true, requestBody: true));
}
getApplicationDocumentsDirectory().then((Directory appDocDir) async {
final String appDocPath =…