Deleted deprecated profile func and profile.dart (#57841)
This commit is contained in:
@@ -52,7 +52,6 @@ export 'src/foundation/object.dart';
|
||||
export 'src/foundation/observer_list.dart';
|
||||
export 'src/foundation/platform.dart';
|
||||
export 'src/foundation/print.dart';
|
||||
export 'src/foundation/profile.dart';
|
||||
export 'src/foundation/serialization.dart';
|
||||
export 'src/foundation/stack_frame.dart';
|
||||
export 'src/foundation/synchronous_future.dart';
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
// 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.
|
||||
|
||||
import 'basic_types.dart';
|
||||
import 'constants.dart';
|
||||
|
||||
/// DEPRECATED. `function` cannot be tree-shaken out of release builds.
|
||||
///
|
||||
/// Instead use:
|
||||
///
|
||||
/// ```dart
|
||||
/// if (!kReleaseMode) {
|
||||
/// function();
|
||||
/// }
|
||||
/// ```
|
||||
@Deprecated(
|
||||
'Use `if (!kReleaseMode) { function(); }` instead. '
|
||||
'This feature was deprecated after v1.3.9.'
|
||||
)
|
||||
void profile(VoidCallback function) {
|
||||
if (kReleaseMode)
|
||||
return;
|
||||
function();
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// 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.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../flutter_test_alternative.dart';
|
||||
|
||||
void main() {
|
||||
// TODO(devoncarew): This test - while very nice - isn't testing what we really want to know:
|
||||
// that the code in the `profile` closure is omitted in release mode.
|
||||
test('profile invokes its closure in debug or profile mode', () {
|
||||
int count = 0;
|
||||
profile(() { // ignore: deprecated_member_use_from_same_package
|
||||
count++;
|
||||
});
|
||||
// We run our tests in debug mode, so kReleaseMode will always evaluate to
|
||||
// false...
|
||||
expect(count, kReleaseMode ? 0 : 1);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user