tecom_push_service 0.0.6
tecom_push_service: ^0.0.6 copied to clipboard
tecom push service plugin
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:tecom_push_service/tecom_push_service.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _tecomPushServicePlugin = TecomPushService();
@override
void initState() {
super.initState();
_tecomPushServicePlugin.addEventHandler(onOpenNotification: _onOpenNotification);
}
Future<void> _onOpenNotification(Map<String, dynamic> message) async {
print("_onOpenNotification $message");
}
_token() async{
final token = await _tecomPushServicePlugin.getDeviceToken();
print(token);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: TextButton(
onPressed: _token,
child: Text("get token"),
),
),
),
);
}
}