Unverified Commit e7661905 authored by Kirill's avatar Kirill Committed by GitHub

Deleted deprecated profile func and profile.dart (#57841)

parent 4465ff9e
......@@ -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';
......
// 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();
}
// 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);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment