🐛 Fix unmounted setState
This commit is contained in:
@@ -55,16 +55,20 @@ class _EmbedLinkWidgetState extends State<EmbedLinkWidget> {
|
||||
stream.removeListener(listener);
|
||||
|
||||
final aspectRatio = info.image.width / info.image.height;
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isSquare = aspectRatio >= 0.9 && aspectRatio <= 1.1;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
// If error, assume not square
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isSquare = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _launchUrl() async {
|
||||
final uri = Uri.parse(widget.link.url);
|
||||
|
||||
Reference in New Issue
Block a user