lock_unlock_device 0.0.1 lock_unlock_device: ^0.0.1 copied to clipboard
A new Flutter plugin.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:lock_unlock_device/lock_unlock_device.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Lock Device'),
),
body: Center(
child: FlatButton(
color: Colors.red,
textColor: Colors.white,
onPressed: (){
// Platform messages may fail, so we use a try/catch PlatformException.
try {
LockUnlockDevice.lockDevice();
} on PlatformException {
throw("PlatformException is raised");
}
},
child: Text('Lock device'),
),
),
),
);
}
}