ios_screen_recorder 0.0.2
ios_screen_recorder: ^0.0.2 copied to clipboard
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 _urlText = 'Unknown';
final _screenRecorderPlugin = ScreenRecorder();
@override
void initState() {
super.initState();
startRecord();
}
Future<void> startRecord() async {
String platformVersion;
try {
platformVersion =
await _screenRecorderPlugin.startScreenRecord() ?? 'Start recording failure.';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
}
Future<void> stopRecord() async {
String platformVersion;
try {
platformVersion =
await _screenRecorderPlugin.stopScreenRecord() ?? 'Stop recording failure.';
} on PlatformException {
platformVersion = '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('VideoUrl: $_urlText\n'),
ElevatedButton(onPressed: (){
stopRecord();
}, child: const Text('STOP Record'))
]),
),
),
);
}
}