This is an open issue for package:image`. I'm not sure if any package already supports encoding webp on pub.
You could use FFIgen to generate bindings for https://github.com/webmproject/libwebp yourself and use that.