简体   繁体   English

在 Flutter 上创建构建风格

[英]Create build flavor on Flutter

I'm new on Flutter but I'm Android developer.我是 Flutter 的新手,但我是 Android 开发人员。

When I created a new Android project.当我创建一个新的 Android 项目时。 I always prepare two build variant debug and release which provide me a BuildConfig.DEBUG variable with the value depended on which build variant I choose.我总是准备两个构建变体debugrelease ,它们为我提供了一个BuildConfig.DEBUG变量,其值取决于我选择的构建变体。 I'm not sure about iOS.我不确定iOS。 However, when I created a new Flutter project, I cant find the ways to point the gradle build me something like that.但是,当我创建一个新的 Flutter 项目时,我找不到指向 gradle 构建我这样的东西的方法。

Example code:示例代码:

class RikimaruApplication extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Rikimaru Application",
      theme: ThemeData(),
      debugShowCheckedModeBanner: false,  \\ => debugShowCheckedModeBanner: BuildConfig.DEBUG,
    );
  }
}

安卓工作室

I searched Google with flutter build variants key word but fail.我用flutter build variants关键字搜索了谷歌,但失败了。 Please teach me how to research about this problem.请教我如何研究这个问题。

The keyword word would be flutter flavour 关键字词将是扑扑的味道

And you can check this link for more information on flutter flavouring. 您可以检查此链接以获取有关扑打调味的更多信息。

there is no magic bullet for that.没有灵丹妙药。 and it's easy i think.我认为这很容易。
you can use this link that is suggested by google :你可以使用谷歌推荐的这个链接:
https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36 https://medium.com/@salvatoregiordanoo/flavoring-flutter-392aaa875f36

and it can be in few steps :它可以通过几个步骤:

-Creating new config files in flutter app ( each can have flavor to run ) . - 在 flutter 应用程序中创建新的配置文件(每个文件都可以运行)。

在此处输入图片说明

-having that "Build flavor" name in android and ios .. android should be productFlavors ...ios should be Schemas .. choose config for run in flutter and Well Done! - 在 android 和 ios 中使用“Build flavor”名称.. android 应该是productFlavors ...ios 应该是Schemas .. 选择配置以在 flutter 中运行并且做得好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM