You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
877 B
27 lines
877 B
import 'package:flutter/foundation.dart'; |
|
import 'package:flutter/services.dart'; |
|
|
|
import 'embedder_texture_platform_interface.dart'; |
|
|
|
/// An implementation of [LinuxOpenglPlatform] that uses method channels. |
|
class MethodChannelEmbedderTexture extends EmbedderTexturePlatform { |
|
/// The method channel used to interact with the native platform. |
|
@visibleForTesting |
|
final methodChannel = const MethodChannel('embedder_texture'); |
|
|
|
@override |
|
Future<Map<dynamic, dynamic>> create(double width, double height) async { |
|
final data = await methodChannel.invokeMethod<Map<dynamic, dynamic>?>('create', { |
|
'width': width.round(), |
|
'height': height.round(), |
|
}); |
|
return data ?? {}; |
|
} |
|
|
|
@override |
|
Future<bool> remove(int textureId) async { |
|
return await methodChannel.invokeMethod<bool>('remove', { |
|
'textureId': textureId, |
|
}) ?? false; |
|
} |
|
}
|
|
|