screen_record_detection 0.0.2 copy "screen_record_detection: ^0.0.2" to clipboard
screen_record_detection: ^0.0.2 copied to clipboard

Flutter plugin for detecting screen recording, works for android 15 and ios.

example/lib/main.dart

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

import 'package:screen_record_detection/screen_record_detection.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 _detector = ScreenRecordDetector();
  late Stream<bool> _recordingSubscription;

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

  void _startMonitoring() {
    _recordingSubscription = _detector.onRecordingStateChanged
        .asBroadcastStream();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Screen Recording demo')),
        body: StreamBuilder<bool>(
          stream: _recordingSubscription,
          builder: (context, asyncSnapshot) {
            return SizedBox(
              width: double.infinity,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisSize: MainAxisSize.max,
                children: [
                  Text(
                    asyncSnapshot.data == true
                        ? "Screen is being recorded"
                        : "No recording detected",
                    style: const TextStyle(fontSize: 16),
                  ),
                  const SizedBox(height: 30),
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}
2
likes
140
points
252
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for detecting screen recording, works for android 15 and ios.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on screen_record_detection

Packages that implement screen_record_detection