xeno_flutter_ios 1.0.8 copy "xeno_flutter_ios: ^1.0.8" to clipboard
xeno_flutter_ios: ^1.0.8 copied to clipboard

iOS implementation of xeno_sdk.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:xeno_flutter_ios/xeno_flutter_ios.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 _xenoSdkIosPlugin = XenoFlutterIos();
  bool? _hasNotificationPermission;

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    bool? hasNotificationPermission;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      hasNotificationPermission =
          await _xenoSdkIosPlugin.hasNotificationPermission();
    } on PlatformException {
      hasNotificationPermission = 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;

    setState(() {
      _hasNotificationPermission = hasNotificationPermission;
    });
  }

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

Publisher

unverified uploader

Weekly Downloads

iOS implementation of xeno_sdk.

Homepage

License

unknown (license)

Dependencies

flutter, xeno_flutter_platform_interface

More

Packages that depend on xeno_flutter_ios

Packages that implement xeno_flutter_ios