Skip to content

Commit e305d1a

Browse files
committed
feat: enable aot
1 parent cc310c1 commit e305d1a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

embedder/embedder.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,17 @@ func (flu *FlutterEngine) Run(userData unsafe.Pointer, vmArgs []string) error {
132132
}
133133

134134
if C.FlutterEngineRunsAOTCompiledDartCode() {
135-
// elfSnapshotPath := C.CString(flu.ElfSnapshotPath)
136-
// defer C.free(unsafe.Pointer(elfSnapshotPath))
135+
elfSnapshotPath := C.CString(flu.ElfSnapshotPath)
136+
defer C.free(unsafe.Pointer(elfSnapshotPath))
137137

138-
// dataIn := C.FlutterEngineAOTDataSource{}
138+
dataIn := C.FlutterEngineAOTDataSource{}
139139

140-
// C.createAOTDataSource(&dataIn, elfSnapshotPath)
141-
// res := (Result)(C.FlutterEngineCreateAOTData(&dataIn, &flu.aotDataSource))
142-
// if res != ResultSuccess {
143-
// return res.GoError("C.FlutterEngineCreateAOTData()")
144-
// }
145-
// args.aot_data = flu.aotDataSource
140+
C.createAOTDataSource(&dataIn, elfSnapshotPath)
141+
res := (Result)(C.FlutterEngineCreateAOTData(&dataIn, &flu.aotDataSource))
142+
if res != ResultSuccess {
143+
return res.GoError("C.FlutterEngineCreateAOTData()")
144+
}
145+
args.aot_data = flu.aotDataSource
146146
}
147147

148148
args.struct_size = C.size_t(unsafe.Sizeof(args))
@@ -167,10 +167,10 @@ func (flu *FlutterEngine) Shutdown() error {
167167
}
168168

169169
if C.FlutterEngineRunsAOTCompiledDartCode() {
170-
// res := (Result)(C.FlutterEngineCollectAOTData(flu.aotDataSource))
171-
// if res != ResultSuccess {
172-
// return res.GoError("engine.Shutdown()")
173-
// }
170+
res := (Result)(C.FlutterEngineCollectAOTData(flu.aotDataSource))
171+
if res != ResultSuccess {
172+
return res.GoError("engine.Shutdown()")
173+
}
174174
}
175175
return nil
176176
}

0 commit comments

Comments
 (0)