Created
October 18, 2019 16:45
-
-
Save MariaMelnik/77991e443cd372f02f0388a34013b1c4 to your computer and use it in GitHub Desktop.
dart: immutable classes question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter_web/material.dart'; | |
void main() { | |
num n = 5.5 % 1; | |
print(n.toString()); | |
} | |
@immutable | |
class Unmodifiable { | |
final Test iCantBeNull; | |
final Test iCanBeNull; | |
Unmodifiable({ | |
@required this.iCantBeNull, | |
this.iCanBeNull | |
}); | |
Unmodifiable copyWith({Test iCantBeNull, Test iCanBeNull}) => | |
Unmodifiable( | |
// Как мне передать "реальный" null сюда? Или что делать вместо этого (красивое)? | |
iCanBeNull: iCanBeNull ?? this.iCanBeNull, | |
iCantBeNull: iCantBeNull ?? this.iCantBeNull | |
); | |
} | |
class Test {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment