createTexture static method

Future<FlutterAngleTexture> createTexture(
  1. AngleOptions options
)

Implementation

static Future<FlutterAngleTexture> createTexture(AngleOptions options) async {
  final _divId = DateTime.now().microsecondsSinceEpoch;
  final element = CanvasElement(
    width: (options.width * options.dpr).toInt(),
    height: (options.height * options.dpr).toInt()
  )..id = 'canvas-id${math.Random().nextInt(100)}';

  ui.platformViewRegistry.registerViewFactory(_divId.toString(), (int viewId) {
    return element;
  });

  final newTexture = FlutterAngleTexture.fromMap({
    "textureId": _divId
  }, element, 0, options);

  return newTexture;
}