Skip to content

Commit

Permalink
[web] cache canvaskit detection (flutter#30954)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahwilliams authored Jan 22, 2022
1 parent 9ba7fdf commit 901b278
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/web_ui/lib/src/engine/canvaskit/initialization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ import 'canvaskit_api.dart';
import 'fonts.dart';

/// Whether to use CanvasKit as the rendering backend.
bool get useCanvasKit => FlutterConfiguration.flutterWebAutoDetect ? _detectRenderer() : FlutterConfiguration.useSkia;
final bool useCanvasKit = FlutterConfiguration.flutterWebAutoDetect
? _hasCanvasKit
: FlutterConfiguration.useSkia;

/// Returns true if CanvasKit is used.
///
/// Otherwise, returns false.
bool _detectRenderer() {
final bool _hasCanvasKit = _detectCanvasKit();

bool _detectCanvasKit() {
if (requestedRendererType != null) {
return requestedRendererType! == 'canvaskit';
}
Expand Down

0 comments on commit 901b278

Please sign in to comment.