简体   繁体   中英

Press Lock (power) button from Flutter App

I want to have a button that onpress will lock the phone screen just like the power button on phone. It should work as a lock button.

Which function required on Flutter to do this??

I don't know about any plugin that can help for this, but it can be achieved through this,

  • Write a function (Platform Specific Code), and through Platform Channel invoke particular function written in android from flutter, which will lock your device.

See docs here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM