socket.io-client-dart
socket.io-client-dart copied to clipboard
Flutter Web update headers not working
I have the problem that I can't change the headers in Flutter Web with the Flutter Map update function. MacOS, iOS & Android works.
Socket socket = io(
const String.fromEnvironment(
'BASE_URL',
),
OptionBuilder()
.setTransports(['websocket'])
.setPath('/sockets')
.setExtraHeaders({
'authorization': '',
})
.setAuth({'authToken': ''})
.enableReconnection()
.setReconnectionAttempts(5)
.build(),
);
Here is the part that doesn't work in Flutter Web:
socket.opts!.update(
'extraHeaders',
(value) => {
'authorization': _token,
},
);