Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion flutter/jujuba_svg/lib/core/jujuba_widget.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:flutter/material.dart';
import 'package:jujuba_svg/core/commander/jujuba_commander.dart';
import 'package:jujuba_svg/core/constants.dart';
Expand Down Expand Up @@ -87,6 +89,8 @@ class JujubaSVGWidget extends StatefulWidget {
class _JujubaWebViewState extends State<JujubaSVGWidget> {
late final WebViewController _controller;

StreamSubscription<String>? _streamSubscription = null;

_JujubaWebViewState();

@override
Expand Down Expand Up @@ -116,7 +120,7 @@ class _JujubaWebViewState extends State<JujubaSVGWidget> {

await _controller.loadHtmlString(completeHtml);

widget.commander.stream.listen(
_streamSubscription = widget.commander.stream.listen(
(jsCommand) => _runJavascript(jsCommand),
);
}
Expand Down Expand Up @@ -159,4 +163,11 @@ class _JujubaWebViewState extends State<JujubaSVGWidget> {
controller: _controller,
);
}

@override
void dispose() {
_streamSubscription?.cancel();

super.dispose();
}
}
2 changes: 1 addition & 1 deletion flutter/jujuba_svg/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: jujuba_svg
description: "JujubaSVG is a Flutter library provided by CodandoTV to make SVG manipulation easy and reactive."
homepage: "https://github.com/CodandoTV/jujubaSVG?tab=readme-ov-file"

version: 1.1.0
version: 1.1.1

environment:
sdk: ^3.5.0
Expand Down