Skip to content

Housekeeping: small correctness and hygiene items #51

Description

@developerjamiu

Small items found during the audit, grouped because none justifies its own issue.

  • lib/src/models/item_span.dart:48 uses bool operator ==(covariant ItemSpan other). The covariant inserts a runtime downcast, so comparing an ItemSpan with any other type throws TypeError instead of returning false. Use Object other with an is check.
  • lib/src/models/item_span.dart:57 omits rawValue from hashCode while == includes it. Legal, but spans differing only in rawValue collide unnecessarily.
  • pubspec.yaml depends on url_launcher_ios directly. It is an endorsed implementation of url_launcher; depending on it pins an implementation package callers should never see.
  • example/lib/smart_text.dart is 104 lines and imported by nothing.
  • lib/src/extensions/string.dart:4 matches startsWith('http'), which also matches httpfoo, and the Uri.parse on the next line can throw inside build.
  • lib/src/extensions/item_span_default_config.dart:85 uses canLaunchUrl then launchUrl, the check-then-act pattern url_launcher's own docs advise against.
  • lib/src/extensions/item_span_default_config.dart:45-47 has a comment in the datetime branch that talks about "the formatted phone number" and "the phone field".
  • TextClassifier.swift and NSDataDetectorExtension.swift both open with // SmartTextFlutterBridge.swift and // Runner headers from whatever file they began as.
  • flutter_lints: ^2.0.0 is several majors behind.

Good first issue material.

Found during the v0.4.0 codebase audit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions