2024-10-14 12:24:54 -04:00
|
|
|
import 'package:web/web.dart' as web;
|
2024-08-15 10:12:26 -04:00
|
|
|
import 'package:web_socket_channel/web_socket_channel.dart';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
|
|
|
|
class Storer {
|
|
|
|
Future<String?> getKey(String key) async {
|
2024-10-14 12:24:54 -04:00
|
|
|
return web.window.localStorage[key];
|
2024-08-15 10:12:26 -04:00
|
|
|
}
|
|
|
|
|
2024-08-15 13:57:26 -04:00
|
|
|
Future<void> setKey(String key, String value) async {
|
2024-10-14 12:24:54 -04:00
|
|
|
web.window.localStorage[key] = value;
|
2024-08-15 10:12:26 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Socketer {
|
|
|
|
late WebSocketChannel channel;
|
|
|
|
|
|
|
|
WebSocketSink get sink {
|
|
|
|
return channel.sink;
|
|
|
|
}
|
|
|
|
|
|
|
|
Stream<dynamic> get stream {
|
|
|
|
return channel.stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
String? updateCookie(http.Response response) {
|
|
|
|
return response.headers['set-cookie'];
|
|
|
|
}
|
|
|
|
|
|
|
|
void setCookie(String token) {}
|
|
|
|
|
|
|
|
void connect(Uri uri) {
|
|
|
|
channel = WebSocketChannel.connect(uri);
|
|
|
|
}
|
|
|
|
}
|