Skip to content

Commit a1e5018

Browse files
committed
Conditions Constant Restore
- Conditions can now be constant again.
1 parent 28d339a commit a1e5018

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/responsive_value.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ class Condition<T> {
154154
final String? name;
155155
final Conditional? condition;
156156
final T? value;
157-
late T? landscapeValue;
157+
final T? landscapeValue;
158158

159159
Condition._(
160160
{this.breakpointStart,
@@ -167,28 +167,28 @@ class Condition<T> {
167167
assert(breakpointStart != null || name != null),
168168
assert((condition == Conditional.EQUALS) ? name != null : true);
169169

170-
Condition.equals({required this.name, this.value, T? landscapeValue})
170+
const Condition.equals({required this.name, this.value, T? landscapeValue})
171171
: landscapeValue = (landscapeValue ?? value),
172172
breakpointStart = null,
173173
breakpointEnd = null,
174174
condition = Conditional.EQUALS;
175175

176-
Condition.largerThan(
176+
const Condition.largerThan(
177177
{int? breakpoint, this.name, this.value, T? landscapeValue})
178178
: landscapeValue = (landscapeValue ?? value),
179179
breakpointStart = breakpoint,
180180
breakpointEnd = breakpoint,
181181
condition = Conditional.LARGER_THAN;
182182

183-
Condition.smallerThan(
183+
const Condition.smallerThan(
184184
{int? breakpoint, this.name, this.value, T? landscapeValue})
185185
: landscapeValue = (landscapeValue ?? value),
186186
breakpointStart = breakpoint,
187187
breakpointEnd = breakpoint,
188188
condition = Conditional.SMALLER_THAN;
189189

190190
/// Conditional when screen width is between [start] and [end] inclusive.
191-
Condition.between(
191+
const Condition.between(
192192
{required int? start, required int? end, this.value, T? landscapeValue})
193193
: landscapeValue = (landscapeValue ?? value),
194194
breakpointStart = start,

0 commit comments

Comments
 (0)