mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Updates the expected steps in the async function defined within `stepping_project.dart`. The Dart web team is updating the async semantics of DDC to bring them in line with the other backends. Currently, the DDC async semantics don't adhere to the Dart spec and this can lead to inconsistent and surprising results. However, the step-over operation doesn't work well yet with the new DDC async semantics. In the long run we intend to improve this but until then the debug stepper will have sporadic results that we can't model well with this test. When we are able to fix the stepper functionality, we will return this test to cover more of the async function being stepped over.
118 lines
2.6 KiB
Dart
118 lines
2.6 KiB
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 'project.dart';
|
|
|
|
class SteppingProject extends Project {
|
|
@override
|
|
final String pubspec = '''
|
|
name: test
|
|
environment:
|
|
sdk: '>=3.2.0-0 <4.0.0'
|
|
dependencies:
|
|
flutter:
|
|
sdk: flutter
|
|
''';
|
|
|
|
@override
|
|
final String main = r'''
|
|
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
void main() => runApp(MyApp());
|
|
|
|
class MyApp extends StatefulWidget {
|
|
@override
|
|
_MyAppState createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
@override
|
|
void initState() {
|
|
doAsyncStuff();
|
|
super.initState();
|
|
}
|
|
|
|
Future<void> doAsyncStuff() async {
|
|
print("test"); // BREAKPOINT
|
|
await Future.value(true); // STEP 1 // STEP 2
|
|
await Future.microtask(() => true); // STEP 3 // STEP 4
|
|
await Future.delayed(const Duration(milliseconds: 1)); // STEP 5 // STEP 6
|
|
print("done!"); // STEP 7
|
|
} // STEP 8
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
home: Container(),
|
|
);
|
|
}
|
|
}
|
|
''';
|
|
|
|
Uri get breakpointUri => mainDart;
|
|
int get breakpointLine => lineContaining(main, '// BREAKPOINT');
|
|
int lineForStep(int i) => lineContaining(main, '// STEP $i');
|
|
|
|
final int numberOfSteps = 8;
|
|
}
|
|
|
|
class WebSteppingProject extends Project {
|
|
@override
|
|
final String pubspec = '''
|
|
name: test
|
|
environment:
|
|
sdk: '>=3.2.0-0 <4.0.0'
|
|
dependencies:
|
|
flutter:
|
|
sdk: flutter
|
|
''';
|
|
|
|
@override
|
|
final String main = r'''
|
|
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
void main() => runApp(MyApp());
|
|
|
|
class MyApp extends StatefulWidget {
|
|
@override
|
|
_MyAppState createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
@override
|
|
void initState() {
|
|
doAsyncStuff();
|
|
super.initState();
|
|
}
|
|
|
|
Future<void> doAsyncStuff() async {
|
|
print("test"); // BREAKPOINT
|
|
await Future.value(true); // STEP 1
|
|
await Future.microtask(() => true);
|
|
await Future.delayed(const Duration(milliseconds: 1));
|
|
print("done!");
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
home: Container(),
|
|
);
|
|
}
|
|
}
|
|
''';
|
|
|
|
Uri get breakpointUri => mainDart;
|
|
int get breakpointLine => lineContaining(main, '// BREAKPOINT');
|
|
int lineForStep(int i) => lineContaining(main, '// STEP $i');
|
|
|
|
final int numberOfSteps = 1;
|
|
}
|