Skip to content

Instantly share code, notes, and snippets.

@MariaMelnik
Created October 18, 2019 16:45
Show Gist options
  • Save MariaMelnik/77991e443cd372f02f0388a34013b1c4 to your computer and use it in GitHub Desktop.
Save MariaMelnik/77991e443cd372f02f0388a34013b1c4 to your computer and use it in GitHub Desktop.
dart: immutable classes question
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