socketnotifs 1.0.0
socketnotifs: ^1.0.0 copied to clipboard
SocketNotifs is a Dart plugin for Flutter applications that facilitates easy WebSocket connections for notifications
import 'package:flutter/material.dart';
import 'package:socketnotifs/socketnotifs.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
//Establish connection
SocketNotifs.connectToWebSocket("ws://10.0.2.2:4000");
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: const Center(
child: Text('Running on: drugs\n'),
),
),
);
}
}