@@ -561,34 +561,34 @@ const String DESKTOP = 'DESKTOP';
561561/// such as [ResponsiveWrapperData.scaledWidth] .
562562@immutable
563563class ResponsiveWrapperData {
564- final double ? screenWidth;
565- final double ? screenHeight;
566- final double ? scaledWidth;
567- final double ? scaledHeight;
568- final List <ResponsiveBreakpoint >? breakpoints;
569- final List <ResponsiveBreakpointSegment ?> ? breakpointSegments;
570- final ResponsiveBreakpoint ? activeBreakpoint;
571- final bool ? isMobile;
572- final bool ? isPhone;
573- final bool ? isTablet;
574- final bool ? isDesktop;
564+ final double screenWidth;
565+ final double screenHeight;
566+ final double scaledWidth;
567+ final double scaledHeight;
568+ final List <ResponsiveBreakpoint > breakpoints;
569+ final List <ResponsiveBreakpointSegment > breakpointSegments;
570+ final ResponsiveBreakpoint activeBreakpoint;
571+ final bool isMobile;
572+ final bool isPhone;
573+ final bool isTablet;
574+ final bool isDesktop;
575575
576576 /// Creates responsive data with explicit values.
577577 ///
578578 /// Consider using [ResponsiveWrapperData.fromResponsiveWrapper]
579579 /// to create data based on the [ResponsiveWrapper] state.
580580 const ResponsiveWrapperData ({
581- this .screenWidth,
582- this .screenHeight,
583- this .scaledWidth,
584- this .scaledHeight,
585- this .breakpoints,
586- this .breakpointSegments,
587- this .activeBreakpoint,
588- this .isMobile,
589- this .isPhone,
590- this .isTablet,
591- this .isDesktop,
581+ this .screenWidth = 0 ,
582+ this .screenHeight = 0 ,
583+ this .scaledWidth = 0 ,
584+ this .scaledHeight = 0 ,
585+ this .breakpoints = const [] ,
586+ this .breakpointSegments = const [] ,
587+ this .activeBreakpoint = const ResponsiveBreakpoint . tag ( 0 , name : '' ) ,
588+ this .isMobile = false ,
589+ this .isPhone = false ,
590+ this .isTablet = false ,
591+ this .isDesktop = false ,
592592 });
593593
594594 /// Creates data based on the [ResponsiveWrapper] state.
@@ -624,7 +624,7 @@ class ResponsiveWrapperData {
624624 ', scaledHeight: ' +
625625 scaledHeight.toString () +
626626 ', breakpoints: ' +
627- ( breakpoints? .asMap () ?? '' ).toString () +
627+ breakpoints.asMap ().toString () +
628628 ', breakpointSegments: ' +
629629 breakpointSegments.toString () +
630630 ', activeBreakpoint: ' +
@@ -639,30 +639,29 @@ class ResponsiveWrapperData {
639639 isDesktop.toString () +
640640 ')' ;
641641
642- bool equals (String ? name) => activeBreakpoint! .name == name;
642+ bool equals (String ? name) => activeBreakpoint.name == name;
643643
644644 /// Is the [scaledWidth] larger than or equal to [name] ?
645645 /// Defaults to false if the [name] cannot be found.
646646 bool isLargerThan (String ? name) {
647647 // No breakpoints to match.
648- if (breakpoints! .length == 0 ) return false ;
648+ if (breakpoints.length == 0 ) return false ;
649649
650650 // Breakpoint is active breakpoint.
651- if (activeBreakpoint! .name == name) return false ;
651+ if (activeBreakpoint.name == name) return false ;
652652
653653 // Single breakpoint is active and screen width
654654 // is larger than default breakpoint.
655- if (breakpoints! .length == 1 &&
656- screenWidth! >= breakpoints! [0 ].breakpoint) {
655+ if (breakpoints.length == 1 && screenWidth >= breakpoints[0 ].breakpoint) {
657656 return true ;
658657 }
659658 // Find first breakpoint end boundary that is larger
660659 // than screen width. Breakpoint names could be
661660 // chained so perform a full search from largest to smallest.
662- for (var i = breakpoints! .length - 2 ; i >= 0 ; i-- ) {
663- if (breakpoints! [i].name == name &&
664- breakpoints! [i + 1 ].name != name &&
665- screenWidth! >= breakpoints! [i + 1 ].breakpoint) return true ;
661+ for (var i = breakpoints.length - 2 ; i >= 0 ; i-- ) {
662+ if (breakpoints[i].name == name &&
663+ breakpoints[i + 1 ].name != name &&
664+ screenWidth >= breakpoints[i + 1 ].breakpoint) return true ;
666665 }
667666
668667 return false ;
@@ -671,19 +670,19 @@ class ResponsiveWrapperData {
671670 /// Is the [screenWidth] smaller than the [name] ?
672671 /// Defaults to false if the [name] cannot be found.
673672 bool isSmallerThan (String ? name) =>
674- screenWidth! <
675- breakpointSegments!
676- .firstWhere ((element) => element! .responsiveBreakpoint.name == name,
673+ screenWidth <
674+ breakpointSegments
675+ .firstWhere ((element) => element.responsiveBreakpoint.name == name,
677676 orElse: () => ResponsiveBreakpointSegment (
678677 breakpoint: 0 ,
679678 segmentType: ResponsiveBreakpointBehavior .TAG ,
680- responsiveBreakpoint: ResponsiveBreakpoint .tag (0 , name: '' )))!
679+ responsiveBreakpoint: ResponsiveBreakpoint .tag (0 , name: '' )))
681680 .breakpoint;
682681
683- ResponsiveBreakpoint ? firstBreakpointNamed (String name) => breakpointSegments!
684- .firstWhere ((element) => element! .responsiveBreakpoint.name == name,
682+ ResponsiveBreakpoint ? firstBreakpointNamed (String name) => breakpointSegments
683+ .firstWhere ((element) => element.responsiveBreakpoint.name == name,
685684 orElse: null )
686- ? .responsiveBreakpoint;
685+ .responsiveBreakpoint;
687686}
688687
689688/// Creates an immutable widget that exposes [ResponsiveWrapperData]
0 commit comments