gpuUnavailableReason function

String? gpuUnavailableReason()

Why Flutter GPU can't be used here, or null when it can.

Tests that render call this first and skip when it returns a reason, so a plain flutter test stays green. Run them with flutter test --enable-impeller --enable-flutter-gpu --tags gpu.

Implementation

String? gpuUnavailableReason() {
  try {
    gpu.gpuContext;
    return null;
  } on Object catch (e) {
    return '$e';
  }
}