mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-07-17 17:36:59 +08:00
Add:创建 flutter go web 版
This commit is contained in:
19
packages/flutter_web_test/lib/src/nonconst.dart
Normal file
19
packages/flutter_web_test/lib/src/nonconst.dart
Normal file
@ -0,0 +1,19 @@
|
||||
/// This function can be used to call a const constructor in such a way as to
|
||||
/// create a new instance rather than creating the common const instance.
|
||||
///
|
||||
/// ```dart
|
||||
/// class A {
|
||||
/// const A(this.i);
|
||||
/// int i;
|
||||
/// }
|
||||
///
|
||||
/// main () {
|
||||
/// // prevent prefer_const_constructors lint
|
||||
/// new A(nonconst(null));
|
||||
///
|
||||
/// // prevent prefer_const_declarations lint
|
||||
/// final int $null = nonconst(null);
|
||||
/// final A a = nonconst(const A(null));
|
||||
/// }
|
||||
/// ```
|
||||
T nonconst<T>(T t) => t;
|
Reference in New Issue
Block a user