xiangpush 0.0.8 copy "xiangpush: ^0.0.8" to clipboard
xiangpush: ^0.0.8 copied to clipboard

阿里推送.

example/lib/main.dart

import 'dart:io';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:xiangpush/xiangpush.dart' as xiangpush;

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';

  @override
  void initState() {
    super.initState();
    // initPlatformState();
    if (!Platform.isAndroid) {
      xiangpush.configureNotificationPresentationOption();
    }

    xiangpush.initCloudChannelResult.listen((data) {
      print(
          "----------->init successful ${data.isSuccessful} ${data.errorCode} ${data.errorMessage}");
    });
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  void initPlatformState() {
    String platformVersion;
    var id = xiangpush.deviceId;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_platformVersion\n'),
        ),
      ),
    );
  }
}
0
likes
125
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

阿里推送.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on xiangpush

Packages that implement xiangpush