flutter_web_notification_platform 1.0.4 copy "flutter_web_notification_platform: ^1.0.4" to clipboard
flutter_web_notification_platform: ^1.0.4 copied to clipboard

A Flutter plugin for web notifications using conditional imports.

example/main.dart

// example/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_web_notification_platform/flutter_web_notification_platform.dart';

void main() {
  
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final PlatformNotification platformNotification = PlatformNotificationWeb();
@override
void initState() { 
    platformNotification.requestPermission();
  super.initState();
  
}
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Web Push Notifications Example'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
            
              platformNotification.sendNotification('Hello!', 'This is a test notification.');
            },
            child: Text('Send Notification'),
          ),
        ),
      ),
    );
  }
}
3
likes
80
points
574
downloads

Publisher

verified publisherkitahealth.my.id

Weekly Downloads

A Flutter plugin for web notifications using conditional imports.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, logger

More

Packages that depend on flutter_web_notification_platform