toObject method Null safety

  1. @protected
Object? toObject(
  1. String? id,
  2. [String? groupName]
)

Returns the Dart object associated with a reference id.

The groupName parameter is not required by is added to regularize the API surface of the methods in this class called from the Flutter IntelliJ Plugin.

Implementation

@protected
Object? toObject(String? id, [ String? groupName ]) {
  if (id == null) {
    return null;
  }

  final _InspectorReferenceData? data = _idToReferenceData[id];
  if (data == null) {
    throw FlutterError.fromParts(<DiagnosticsNode>[ErrorSummary('Id does not exist.')]);
  }
  return data.object;
}