From d5a596a48e5832b95b08de3e46287c3668f68b7e Mon Sep 17 00:00:00 2001 From: Pascal Welsch Date: Thu, 7 Nov 2024 02:53:56 +0100 Subject: [PATCH] Cleanup dependencies --- lib/src/timeline/html/print_html.dart | 6 ++---- lib/src/timeline/timeline.dart | 5 ++--- pubspec.yaml | 2 ++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/src/timeline/html/print_html.dart b/lib/src/timeline/html/print_html.dart index 133427ad..8a1208a7 100644 --- a/lib/src/timeline/html/print_html.dart +++ b/lib/src/timeline/html/print_html.dart @@ -2,9 +2,7 @@ import 'dart:convert'; import 'dart:io'; -import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; -import 'package:path/path.dart' as path; import 'package:spot/src/screenshot/screenshot.dart'; import 'package:spot/src/timeline/html/script.js.dart'; import 'package:spot/src/timeline/html/styles.css.dart'; @@ -53,7 +51,7 @@ extension HtmlTimelinePrinter on Timeline { return 'timeline-$name.html'; }(); - final htmlFile = File(path.join(spotTempDir.path, nameForHtml)); + final htmlFile = File('${spotTempDir.path}/$nameForHtml'); final content = _timelineAsHTML(timeLineEvents: events); htmlFile.writeAsStringSync(content); //ignore: avoid_print @@ -120,7 +118,7 @@ String _timelineAsHTML({required List timeLineEvents}) { String? projectDir; while (dir != null) { - final ideaDir = Directory(path.join(dir.path, '.idea')); + final ideaDir = Directory('${dir.path}/.idea'); if (ideaDir.existsSync()) { // Update to the current directory path projectDir = dir.path; diff --git a/lib/src/timeline/timeline.dart b/lib/src/timeline/timeline.dart index d09f06b3..5ddad756 100644 --- a/lib/src/timeline/timeline.dart +++ b/lib/src/timeline/timeline.dart @@ -4,7 +4,6 @@ import 'dart:io'; import 'package:ci/ci.dart'; import 'package:clock/clock.dart'; -import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:spot/src/screenshot/screenshot.dart'; @@ -294,10 +293,10 @@ Frame? mostRelevantCaller({Trace? trace, Frame? fallback}) { final frames = (trace ?? Trace.current()).frames; final nonPackageFrames = frames.where((frame) => frame.package == null); - final testFileCaller = nonPackageFrames.lastWhereOrNull((frame) { + final testFileCaller = nonPackageFrames.where((frame) { final lib = frame.library; return lib.startsWith('test/') && lib.endsWith('_test.dart'); - }); + }).lastOrNull; final preferredFrame = testFileCaller ?? nonPackageFrames.lastOrNull ?? fallback; diff --git a/pubspec.yaml b/pubspec.yaml index eeebb63a..140a1d5e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,7 @@ environment: dependencies: checks: ^0.3.0 ci: ^0.1.0 + clock: ^1.1.0 dartx: ^1.1.0 flutter: sdk: flutter @@ -21,6 +22,7 @@ dependencies: meta: ^1.8.0 nanoid2: ^2.0.0 stack_trace: ^1.11.0 + test_api: '>=0.5.0 <0.8.0' dev_dependencies: image: ^4.0.0