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

PlatformiOS

Screen Recorder plugin is for iOS.

example/lib/main.dart

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

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

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  String _logs = 'Unknown';
  final _screenRecorderPlugin = ScreenRecorder();

  @override
  void initState() {
    super.initState();
    String dirPath = ''; // Add path to save the video.
    startRecord(dirPath);
  }
// Void
  Future<void> startRecord(String dirPath) async {
    try {
      final recordStatus =
          await _screenRecorderPlugin.startScreenRecord(dirPath) ?? 'Start recording failure.';
      setState(() {
        _logs = recordStatus;
      });
    } on PlatformException catch(e) {
      _logs = 'Failed to get platform version.';
    }
  }

  Future<void> stopRecord() async {
    try {
      final videoURL =
          await _screenRecorderPlugin.stopScreenRecord() ?? 'Stop recording failure.';
      setState(() {
        _logs = videoURL;
      });
    } on PlatformException {
      _logs = 'Failed to get platform version.';
    }
  }


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Screen Recorder Plugin example'),
        ),
        body: Center(
          child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Text('log: $_logs\n'),
          ElevatedButton(onPressed: (){
                stopRecord();
          }, child: const Text('STOP Record'))
          ]),
        ),
      ),
    );
  }
}
0
likes
145
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

Screen Recorder plugin is for iOS.

Documentation

API reference

License

BSL-1.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ios_screen_recorder

Packages that implement ios_screen_recorder