is_tv 0.0.1 copy "is_tv: ^0.0.1" to clipboard
is_tv: ^0.0.1 copied to clipboard

outdated

Flutter plugin to check if current device is a Television.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:is_tv/is_tv.dart';

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> {
  bool? _isTV;
  final _isTVPlugin = IsTV();

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

  Future<void> initPlatformState() async {
    bool? isTV;

    try {
      isTV = await _isTVPlugin.check() ?? false;
    } on PlatformException {
      isTV = false;
    }

    if (!mounted) return;

    setState(() {
      _isTV = isTV ?? false;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('is_tv Plugin example app'),
        ),
        body: Center(
          child:
              Text('Current device is ${(_isTV ?? false) ? "" : "NOT"} a TV'),
        ),
      ),
    );
  }
}
2
likes
0
pub points
62%
popularity

Publisher

unverified uploader

Flutter plugin to check if current device is a Television.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on is_tv