File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ import 'dart:async' ;
2+
13import 'package:flutter/material.dart' ;
24import 'package:jujuba_svg/core/commander/jujuba_commander.dart' ;
35import 'package:jujuba_svg/core/constants.dart' ;
@@ -87,6 +89,8 @@ class JujubaSVGWidget extends StatefulWidget {
8789class _JujubaWebViewState extends State <JujubaSVGWidget > {
8890 late final WebViewController _controller;
8991
92+ StreamSubscription <String >? _streamSubscription = null ;
93+
9094 _JujubaWebViewState ();
9195
9296 @override
@@ -116,7 +120,7 @@ class _JujubaWebViewState extends State<JujubaSVGWidget> {
116120
117121 await _controller.loadHtmlString (completeHtml);
118122
119- widget.commander.stream.listen (
123+ _streamSubscription = widget.commander.stream.listen (
120124 (jsCommand) => _runJavascript (jsCommand),
121125 );
122126 }
@@ -159,4 +163,11 @@ class _JujubaWebViewState extends State<JujubaSVGWidget> {
159163 controller: _controller,
160164 );
161165 }
166+
167+ @override
168+ void dispose () {
169+ _streamSubscription? .cancel ();
170+
171+ super .dispose ();
172+ }
162173}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: jujuba_svg
22description : " JujubaSVG is a Flutter library provided by CodandoTV to make SVG manipulation easy and reactive."
33homepage : " https://github.com/CodandoTV/jujubaSVG?tab=readme-ov-file"
44
5- version : 1.1.0
5+ version : 1.1.1
66
77environment :
88 sdk : ^3.5.0
You can’t perform that action at this time.
0 commit comments