flutter_foreground_service 0.1.0+1 flutter_foreground_service: ^0.1.0+1 copied to clipboard
Foreground service for the Android platform
import 'package:flutter/material.dart';
import 'package:flutter_foreground_service/flutter_foreground_service.dart';
void main() {
runApp(MyApp());
startForegroundService();
}
void startForegroundService() async {
await ForegroundService().start();
debugPrint("Started service");
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Foreground service example, check notification bar')),
),
);
}
}