@@ -10,8 +10,8 @@ import 'package:devtools_test/devtools_test.dart';
1010import 'package:flutter_test/flutter_test.dart' ;
1111import 'package:vm_service/vm_service.dart' ;
1212
13- import '../../test_infra/test_data/network.dart' ;
1413import '../../test_infra/test_data/http_get_cancelled_json.dart' ;
14+ import '../../test_infra/test_data/network.dart' ;
1515import 'utils/network_test_utils.dart' ;
1616
1717void main () {
@@ -511,9 +511,7 @@ void main() {
511511 test ('cancelled request should not remain pending' , () {
512512 // No controller needed — construct directly from fixture
513513 final cancelledRequest = DartIOHttpRequestData (
514- HttpProfileRequest .parse (
515- Map <String , dynamic >.from (httpGetCancelledJson),
516- )! ,
514+ HttpProfileRequest .parse (Map <String , dynamic >.of (httpGetCancelledJson))! ,
517515 requestFullDataFromVmService: false ,
518516 );
519517
@@ -523,24 +521,27 @@ void main() {
523521 expect (cancelledRequest.duration, isNotNull);
524522 });
525523
526- test ('request with cancellation evidence is cancelled even with null endTime' , () {
527- final inFlightData = Map <String , dynamic >.from (httpGetCancelledJson)
528- ..['endTime' ] = null ;
524+ test (
525+ 'request with cancellation evidence is cancelled even with null endTime' ,
526+ () {
527+ final inFlightData = Map <String , dynamic >.of (httpGetCancelledJson)
528+ ..['endTime' ] = null ;
529529
530- final inFlightRequest = DartIOHttpRequestData (
531- HttpProfileRequest .parse (inFlightData)! ,
532- requestFullDataFromVmService: false ,
533- );
530+ final inFlightRequest = DartIOHttpRequestData (
531+ HttpProfileRequest .parse (inFlightData)! ,
532+ requestFullDataFromVmService: false ,
533+ );
534534
535- expect (inFlightRequest.isCancelled, true );
536- expect (inFlightRequest.inProgress, false );
537- expect (inFlightRequest.status, 'Cancelled' );
538- expect (inFlightRequest.duration, Duration .zero);
539- });
535+ expect (inFlightRequest.isCancelled, true );
536+ expect (inFlightRequest.inProgress, false );
537+ expect (inFlightRequest.status, 'Cancelled' );
538+ expect (inFlightRequest.duration, Duration .zero);
539+ },
540+ );
540541
541542 test ('request without response and endTime is cancelled' , () {
542543 final pendingRequest = DartIOHttpRequestData (
543- HttpProfileRequest .parse (Map <String , dynamic >.from (httpGetPendingJson))! ,
544+ HttpProfileRequest .parse (Map <String , dynamic >.of (httpGetPendingJson))! ,
544545 requestFullDataFromVmService: false ,
545546 );
546547
@@ -551,7 +552,7 @@ void main() {
551552 });
552553
553554 test ('request without response and null endTime remains pending' , () {
554- final pendingData = Map <String , dynamic >.from (httpGetPendingJson)
555+ final pendingData = Map <String , dynamic >.of (httpGetPendingJson)
555556 ..['endTime' ] = null ;
556557
557558 final pendingRequest = DartIOHttpRequestData (
@@ -566,11 +567,11 @@ void main() {
566567 });
567568
568569 test ('request with incomplete response and status code is completed' , () {
569- final responseData = Map <String , dynamic >.from (
570- ( httpGetJson['response' ] as Map ). cast <String , dynamic >() ,
570+ final responseData = Map <String , dynamic >.of (
571+ httpGetJson['response' ] as Map <String , Object ?> ,
571572 )..['endTime' ] = null ;
572573
573- final cancelledWithStatusData = Map <String , dynamic >.from (httpGetJson)
574+ final cancelledWithStatusData = Map <String , dynamic >.of (httpGetJson)
574575 ..['response' ] = responseData;
575576
576577 final cancelledWithStatusRequest = DartIOHttpRequestData (
@@ -585,13 +586,12 @@ void main() {
585586 });
586587
587588 test ('request with partial response and cancellation error is cancelled' , () {
588- final responseData = Map <String , dynamic >.from (
589- (httpGetJson['response' ] as Map ).cast <String , dynamic >(),
590- )
591- ..['endTime' ] = null
592- ..['error' ] = 'Response stream aborted by client cancellation' ;
589+ final responseData =
590+ Map <String , dynamic >.of (httpGetJson['response' ] as Map <String , Object ?>)
591+ ..['endTime' ] = null
592+ ..['error' ] = 'Response stream aborted by client cancellation' ;
593593
594- final cancelledDuringResponseData = Map <String , dynamic >.from (httpGetJson)
594+ final cancelledDuringResponseData = Map <String , dynamic >.of (httpGetJson)
595595 ..['response' ] = responseData;
596596
597597 final cancelledDuringResponseRequest = DartIOHttpRequestData (
@@ -605,33 +605,36 @@ void main() {
605605 expect (cancelledDuringResponseRequest.duration, Duration .zero);
606606 });
607607
608- test ('request with partial response and generic response error is not cancelled' , () {
609- final responseData = Map <String , dynamic >.from (
610- (httpGetJson['response' ] as Map ).cast <String , dynamic >(),
611- )
612- ..['endTime' ] = null
613- ..['error' ] = 'Connection closed before full response was received' ;
614-
615- final cancelledDuringResponseData = Map <String , dynamic >.from (httpGetJson)
616- ..['response' ] = responseData;
617-
618- final cancelledDuringResponseRequest = DartIOHttpRequestData (
619- HttpProfileRequest .parse (cancelledDuringResponseData)! ,
620- requestFullDataFromVmService: false ,
621- );
608+ test (
609+ 'request with partial response and generic response error is not cancelled' ,
610+ () {
611+ final responseData =
612+ Map <String , dynamic >.of (
613+ httpGetJson['response' ] as Map <String , Object ?>,
614+ )
615+ ..['endTime' ] = null
616+ ..['error' ] = 'Connection closed before full response was received' ;
617+
618+ final cancelledDuringResponseData = Map <String , dynamic >.of (httpGetJson)
619+ ..['response' ] = responseData;
620+
621+ final cancelledDuringResponseRequest = DartIOHttpRequestData (
622+ HttpProfileRequest .parse (cancelledDuringResponseData)! ,
623+ requestFullDataFromVmService: false ,
624+ );
622625
623- expect (cancelledDuringResponseRequest.isCancelled, false );
624- expect (cancelledDuringResponseRequest.status, '200' );
625- });
626+ expect (cancelledDuringResponseRequest.isCancelled, false );
627+ expect (cancelledDuringResponseRequest.status, '200' );
628+ },
629+ );
626630
627631 test ('request with response hasError and status code is not cancelled' , () {
628- final responseData = Map <String , dynamic >.from (
629- (httpGetJson['response' ] as Map ).cast <String , dynamic >(),
630- )
631- ..['error' ] = 'HttpException: connection terminated'
632- ..['endTime' ] = httpGetJson['endTime' ];
632+ final responseData =
633+ Map <String , dynamic >.of (httpGetJson['response' ] as Map <String , Object ?>)
634+ ..['error' ] = 'HttpException: connection terminated'
635+ ..['endTime' ] = httpGetJson['endTime' ];
633636
634- final cancelledData = Map <String , dynamic >.from (httpGetJson)
637+ final cancelledData = Map <String , dynamic >.of (httpGetJson)
635638 ..['response' ] = responseData;
636639
637640 final cancelledRequest = DartIOHttpRequestData (
@@ -644,11 +647,11 @@ void main() {
644647 });
645648
646649 test ('request with request hasError and response present is cancelled' , () {
647- final requestData = Map <String , dynamic >.from (
648- ( httpGetJson['request' ] as Map ). cast <String , dynamic >() ,
650+ final requestData = Map <String , dynamic >.of (
651+ httpGetJson['request' ] as Map <String , Object ?> ,
649652 )..['error' ] = 'Cancelled by client before completion' ;
650653
651- final cancelledData = Map <String , dynamic >.from (httpGetJson)
654+ final cancelledData = Map <String , dynamic >.of (httpGetJson)
652655 ..['request' ] = requestData;
653656
654657 final cancelledRequest = DartIOHttpRequestData (
@@ -661,11 +664,11 @@ void main() {
661664 });
662665
663666 test ('request with request error and incomplete response is cancelled' , () {
664- final requestData = Map <String , dynamic >.from (
665- ( httpGetJson['request' ] as Map ). cast <String , dynamic >() ,
667+ final requestData = Map <String , dynamic >.of (
668+ httpGetJson['request' ] as Map <String , Object ?> ,
666669 )..['error' ] = 'SocketException: connection reset by peer' ;
667670
668- final cancelledData = Map <String , dynamic >.from (httpGetJson)
671+ final cancelledData = Map <String , dynamic >.of (httpGetJson)
669672 ..['request' ] = requestData
670673 ..['response' ] = null ;
671674
0 commit comments