[framework] dont allocate forgotten children set in profile/release mode (#94911)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
class _DebugOnly {
|
||||
const _DebugOnly();
|
||||
}
|
||||
|
||||
const _DebugOnly _debugOnly = _DebugOnly();
|
||||
const bool kDebugMode = bool.fromEnvironment('test-only');
|
||||
|
||||
class Foo {
|
||||
@_debugOnly
|
||||
final Map<String, String>? foo = kDebugMode ? <String, String>{} : null;
|
||||
|
||||
@_debugOnly
|
||||
final Map<String, String>? bar = kDebugMode ? null : <String, String>{};
|
||||
}
|
||||
@@ -193,4 +193,14 @@ void main() {
|
||||
},
|
||||
));
|
||||
});
|
||||
|
||||
test('analyze.dart - verifyNullInitializedDebugExpensiveFields', () async {
|
||||
final String result = await capture(() => verifyNullInitializedDebugExpensiveFields(
|
||||
testRootPath,
|
||||
minimumMatches: 1,
|
||||
), exitCode: 1);
|
||||
|
||||
expect(result, contains('L15'));
|
||||
expect(result, isNot(contains('L12')));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user