easy_local_notify 0.0.1
easy_local_notify: ^0.0.1 copied to clipboard
Cross-platform local notification package for Flutter. Works on Android, iOS, Web, Windows, macOS, and Linux with a simple API.
example/lib/main.dart
// Import the necessary packages
import 'package:easy_local_notify/easy_local_notify.dart'; // Local notification package
import 'package:flutter/material.dart'; // Flutter Material Design widgets
// Main function: entry point of the app
void main() async {
WidgetsFlutterBinding.ensureInitialized(); // Ensure Flutter is initialized
await EasyLocalNotify.init(); // Initialize the notification system
runApp(MyApp()); // Run the app
}
// Main App Widget
class MyApp extends StatelessWidget {
const MyApp({super.key}); // Constructor
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Material App', // App title
home: Scaffold(
appBar: AppBar(
title: const Text('Material App Bar'), // Top AppBar title
),
body: Center( // Center all content
child: Column( // Arrange widgets vertically
children: [
IconButton(
onPressed: () {
// Show a local notification when pressed
EasyLocalNotify.show('Title', 'This appears immediately');
},
icon: Icon(Icons.abc)) // Button icon
],
),
),
),
);
}
}