Skip to content

Instantly share code, notes, and snippets.

@Vanethos
Created September 5, 2019 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vanethos/008816da48d964adf9678c60459a7688 to your computer and use it in GitHub Desktop.
Save Vanethos/008816da48d964adf9678c60459a7688 to your computer and use it in GitHub Desktop.
dynamic requestInterceptor(RequestOptions options) async {
if (options.headers.containsKey("requiresToken")) {
//remove the auxiliary header
options.headers.remove("requiresToken");
SharedPreferences prefs = await SharedPreferences.getInstance();
var header = prefs.get("Header");
options.headers.addAll({"Header": "$header${DateTime.now()}"});
return options;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment