facundomedica / fast_qr_reader_view

A Fast QR Reader widget for Flutter. For both Android and iOS
MIT License
294 stars 163 forks source link

Close scanner onCodeRead #15

Open Cypher-XI opened 5 years ago

Cypher-XI commented 5 years ago

How could I close the scanner properly when onCodeRead is triggered?

my onCodeRead method is,

void onCodeRead(dynamic value) {
    Navigator.pop(context, value.toString());
  }

getting the flowing error log continuously

I/flutter (29734): Another exception was thrown: 'package:flutter/src/widgets/framework.dart': Failed assertion: line 3473 pos 12: '_debugLifecycleState != _ElementLifecycle.defunct': is not true.

How could I fix this issue?

facundomedica commented 5 years ago

Try with:

    controller?.dispose();

before popping the screen

Cypher-XI commented 5 years ago

Try with:

    controller?.dispose();

before popping the screen

No use. I couldn't see any difference in debug console

xellDart commented 5 years ago

sane error

zarulizham commented 5 years ago

I have faced the same problem. My problem solved when I dispose animationController too.

  @override
  void dispose() {
    animationController?.dispose();
    controller?.dispose();
    super.dispose();
  }