简体   繁体   中英

How do I use local auth and bar code scanner in the same flutter project?

I building a flutter app that scans bar codes and also uses biometric auth in it. The problem is for package local_auth

MainActivity.kt should be like

import io.flutter.embedding.android.FlutterFragmentActivity;

  public class MainActivity extends FlutterFragmentActivity {
      // ...
  }

but for scaning bar codes MainActivity.kt should be like

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

else it don't work. How do I use them both in the same project?

Currently you have to replace FlutterActivity with FlutterFragmentActivity yourself in FlutterBarcodeScannerPlugin.java ( like this ).

So you would want to use a fork of the flutter_barcode_scanner plugin where FlutterFragmentActivity is used or you use some other barcode scanner plugin.

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