Unverified Commit 8e6f4684 authored by liyuqian's avatar liyuqian Committed by GitHub

Fix type issue of the timelineEvents assignment (#28530)

This fixes https://github.com/flutter/flutter/issues/28374

The fact that json_rpc_2 is hiding exceptions like this might be a
bigger issue: https://github.com/flutter/flutter/issues/28531

Merge on red because add2app test is currently flaking out according to @dnfield 
parent d27f5390
...@@ -620,7 +620,12 @@ class ServiceEvent extends ServiceObject { ...@@ -620,7 +620,12 @@ class ServiceEvent extends ServiceObject {
_extensionKind = map['extensionKind']; _extensionKind = map['extensionKind'];
_extensionData = map['extensionData']; _extensionData = map['extensionData'];
} }
_timelineEvents = map['timelineEvents']; // map['timelineEvents'] is List<dynamic> which can't be assigned to
// List<Map<String, dynamic>> directly. Unfortunately, we previously didn't
// catch this exception because json_rpc_2 is hiding all these exceptions
// on a Stream.
final List<dynamic> dynamicList = map['timelineEvents'];
_timelineEvents = dynamicList?.cast<Map<String, dynamic>>();
} }
bool get isPauseEvent { bool get isPauseEvent {
...@@ -1293,7 +1298,8 @@ class Isolate extends ServiceObjectOwner { ...@@ -1293,7 +1298,8 @@ class Isolate extends ServiceObjectOwner {
Future<bool> flutterAlreadyPaintedFirstUsefulFrame() async { Future<bool> flutterAlreadyPaintedFirstUsefulFrame() async {
final Map<String, dynamic> result = await invokeFlutterExtensionRpcRaw('ext.flutter.didSendFirstFrameEvent'); final Map<String, dynamic> result = await invokeFlutterExtensionRpcRaw('ext.flutter.didSendFirstFrameEvent');
return result['enabled'] == 'true'; // result might be null when the service extension is not initialized
return result != null && result['enabled'] == 'true';
} }
Future<Map<String, dynamic>> uiWindowScheduleFrame() { Future<Map<String, dynamic>> uiWindowScheduleFrame() {
......
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