extractTokenFromHeader function
Extracts the token from the header
The Header has to be in the Authorization
And the value has to be in the form Bearer Token
If you have yours in another form, You'll have to do it manually
Implementation
String? extractTokenFromHeader(HttpHeaders headers) {
String? value = headers.value('Authorization');
if (value != null) {
var list = value.split(' ');
String token = list[1];
return token;
} else {
return null;
}
}