From 46d21c52445ebd9212f5c0018915ccd9e77adb77 Mon Sep 17 00:00:00 2001 From: JohnE Date: Mon, 6 Oct 2025 21:46:43 -0700 Subject: [PATCH] NEW: moved Link class to be with main Linkify class for type saftey, code completion, all good --- CHANGELOG.md | 5 +++++ lib/src/linkify.dart | 16 +++++++++++++++- lib/src/model/link.dart | 16 ---------------- 3 files changed, 20 insertions(+), 17 deletions(-) delete mode 100644 lib/src/model/link.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 6206e58..effbc3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.2.0 + +- Improved with J3G skillz +- Merged updates from other branches, improves regex + ## 1.1.5 - Enforce lint rules diff --git a/lib/src/linkify.dart b/lib/src/linkify.dart index 5db0618..1f9d3e7 100644 --- a/lib/src/linkify.dart +++ b/lib/src/linkify.dart @@ -3,7 +3,6 @@ import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:linkify_text/src/enum.dart'; -import 'package:linkify_text/src/model/link.dart'; import 'package:linkify_text/src/utils/regex.dart'; /// Linkify [text] containing urls, emails or hashtag @@ -414,3 +413,18 @@ TextSpan _linkify({ return TextSpan(children: spans); } + +/// Model class for Link data +class Link { + late final String? _value; + late final LinkType? _type; + String? get value => _value; + LinkType? get type => _type; + + /// construct link from matched regExp + Link.fromMatch(RegExpMatch match) { + final String _match = match.input.substring(match.start, match.end); + _type = getMatchedType(_match); + _value = _match; + } +} diff --git a/lib/src/model/link.dart b/lib/src/model/link.dart deleted file mode 100644 index 81a6600..0000000 --- a/lib/src/model/link.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:linkify_text/src/enum.dart'; -import 'package:linkify_text/src/utils/regex.dart'; - -class Link { - late final String? _value; - late final LinkType? _type; - String? get value => _value; - LinkType? get type => _type; - - /// construct link from matched regExp - Link.fromMatch(RegExpMatch match) { - final String _match = match.input.substring(match.start, match.end); - _type = getMatchedType(_match); - _value = _match; - } -}