-1

Hi team I'm working on handheld reader to read the tags by pressing the trigger in the handheld reader.

I'm implementing this but the issue is after i got one tag i need to navigate to one screen if the tag is valid means i can able to navigate to the screen but the issue is in that navigated screen if i press the trigger its working there and start to scan the tag how to avoid this ?

void startListening() {
    subscription = myplugin.stream.listen((event) async {
      if (event == HardwareButton.trigger) {
        {
          if (!context.read<MyCubit>().state.isScanning) {
            await context.read<MyCubit>().startScan();
            await Future.delayed(const Duration(milliseconds: 500));
            await _tagsChecking();
          } else {
            context.read<MyCubit>().stopSession();
          }
        }
      }
    });
  }

  void stopListening() {
    subscription?.cancel();
  }

  @override
  void dispose() {
    super.dispose();
    stopListening();
  }

 await Navigator.push(
              context,
              MyHomePage.routeFromPage(
                  RouteSettings(arguments: animals.entries.first.value)),
            ); 

so if the tag is valid it needs to navigated to the above screen but the issue is trigger working even i reached the above page how to fix this

I'm unable to paste full code due to restrictions I'm facing this issue seriously please help

Emilien
  • 614
  • 1
  • 5
  • 17
Manoj
  • 1
  • 3

0 Answers0