golang不能直接返回String到dart ffi,需要使用*C.char

You need to convert your go string to *C.char. C.Cstring is utility function for that.

package main

import "C"

//export returnString
func returnString() *C.char {
    gostring := "hello world"
    return C.CString(gostring)
}

func main() {}

https://stackoverflow.com/questions/48686763/cgo-result-has-go-pointer

你可能感兴趣的:(flutter/dart,Go,golang,c语言,开发语言)