小编Kes*_*ari的帖子

颤动销/密码/模式集成

我已经浏览了local_auth包,它工作正常,但没有选项可以使用密码或引脚进行身份验证.帮助赞赏!

String _authorized = 'Not Authorized';//Start

Future<Null> _authenticate() async {
    final LocalAuthentication auth = new LocalAuthentication();
    bool authenticated = false;
    try {
        authenticated = await auth.authenticateWithBiometrics(
        localizedReason: 'Scan your fingerprint to authenticate',
        useErrorDialogs: true,
        stickyAuth: false);
        authenticated = await auth.authenticateWithBiometrics(localizedReason: 'Authenticate');
    } on PlatformException catch (e) {
        print(e);
    }
    if (!mounted) return;

    setState(() {
      _authorized = authenticated ? 'Authorized' : 'Not Authorized';
    });
}//End
Run Code Online (Sandbox Code Playgroud)

所以这是示例代码,您可以使用生物识别身份验证,但是指纹中还存在默认的Pin/Password身份验证.

flutter localauthentication

6
推荐指数
1
解决办法
412
查看次数

不包含脚手架错误。我知道我的方法没有脚手架方法,但它是有脚手架的方法的子级

// On this noteItem long press i want to show a snackbar 
class NoteItem extends StatelessWidget { 
  NoteItem({Note note, this.removeNote}): note = note, super(key: ObjectKey(note)); 

  final Note note; 
  final RemoveNote removeNote; 

  @override 
  Widget build(BuildContext context){ 
    return ListTile( 
      onLongPress: () { 
    removeNote(note);
  },
  leading: CircleAvatar(
    backgroundColor: Theme.of(context).primaryColor,
    child: Text(note.title[0]),
  ),
  title: Text(note.title),
);
  } 
} 

// This class gives the state`enter code here` 

class _NoteListState extends State<NoteList> { 

  void _addNote() { 
setState(() {
  widget.notes.add(Note(title: 'New Note', description: 'Successfully Added New Note')); …
Run Code Online (Sandbox Code Playgroud)

flutter

2
推荐指数
1
解决办法
1285
查看次数

标签 统计

flutter ×2

localauthentication ×1