blob: 3ffdc120778b5fbde16c8aa79fe864713f2da96a [file] [log] [blame]
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart=2.9
import 'package:kernel/ast.dart' show Component, Library;
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/target/changed_structure_notifier.dart';
import 'package:kernel/target/targets.dart';
import 'package:kernel/transformations/track_widget_constructor_locations.dart';
import 'package:vm/target/vm.dart' show VmTarget;
class FlutterTarget extends VmTarget {
FlutterTarget(TargetFlags flags) : super(flags);
WidgetCreatorTracker _widgetTracker;
String get name => 'flutter';
bool get enableSuperMixins => true;
// This is the order that bootstrap libraries are loaded according to
// `runtime/vm/object_store.h`.
List<String> get extraRequiredLibraries => const <String>[
// The library dart:mirrors may be ignored by the VM, e.g. when built in
// PRODUCT mode.
// Required for flutter.
List<String> get extraRequiredLibrariesPlatform => const <String>[];
void performPreConstantEvaluationTransformations(
Component component,
CoreTypes coreTypes,
List<Library> libraries,
DiagnosticReporter diagnosticReporter,
{void Function(String msg) logger,
ChangedStructureNotifier changedStructureNotifier}) {
component, coreTypes, libraries, diagnosticReporter,
logger: logger, changedStructureNotifier: changedStructureNotifier);
if (flags.trackWidgetCreation) {
if (_widgetTracker == null) {
_widgetTracker = WidgetCreatorTracker();
_widgetTracker.transform(component, libraries, changedStructureNotifier);