dart是否允许用户编写平台特定的实现? [英] Does dart allows users to write platform specific implementation?

查看:51
本文介绍了dart是否允许用户编写平台特定的实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果没有-是否有任何计划要这样做?

If not - are there are any plans to make it so?

我知道dart本身具有不同的后端,这些后端可能具有不同的实现.我很好奇用户是否可以这样做,例如具有一个函数,可将一个 @patch 委托给js运行时,对于dart vm则委托给另一个 @patch .

I know that dart itself has different backends that might have different implementation. I was curious if users can do the same, e.g. have a function that delegates to one @patch for js runtime and to another @patch in case of dart vm.

推荐答案

如果要创建软件包,则可以针对不同平台导出不同的实现,请参见:

If you're creating a package, you can export different implementations for different platforms, see here: https://dart.dev/guides/libraries/create-library-packages#conditionally-importing-and-exporting-library-files

这篇关于dart是否允许用户编写平台特定的实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆