G2Element.fromBytes constructor
G2Element.fromBytes({
- required Uint8List data,
Create a G2Element instance from data
.
Implementation
factory G2Element.fromBytes({required Uint8List data}) {
final dataBuf = malloc.allocate<Uint8>(data.length)
..asTypedList(data.length).setAll(0, data);
final didErr = calloc.allocate<Bool>(1);
final g2 = G2Element(
bindings.CG2ElementFromBytes(dataBuf.cast(), didErr.cast()),
);
malloc.free(dataBuf);
if (didErr.value) {
malloc.free(didErr);
throw BLSException.errFromC();
}
malloc.free(didErr);
return g2;
}