Skip to content

Instantly share code, notes, and snippets.

View akash-bisariya's full-sized avatar
🎯
Learning

Akash Bisariya akash-bisariya

🎯
Learning
View GitHub Profile
void main() {
runApp(
MaterialApp(
title: 'Flutter App',
home: FlutterHome(),
)
);
}
@akash-bisariya
akash-bisariya / Interceptor.java
Created January 15, 2020 14:06 — forked from alex-shpak/Interceptor.java
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON