Android Studio 使用小记2 Flutter提交SVN时需要忽略哪些文件

今天上午发了一篇使用SVN的小记,在解决问题的过程中,发现不少同学在使用Android Studio进行Flutter应用开发时,对需要忽略哪些文件(不提交到SVN协同)不是很明确,对于这个问题,Flutter官方有明确的说明,可通过下面的网址进入了解:

https://dart.dev/guides/libraries/private-files 

What not to commit

When you put Dart source code in a repository—using the pub toolGitHub, or another source code management system—don’t include most of the files that your IDE or code editor, the pub tool, and other tools generate.

info Note: Except where noted, this page discusses only source code repositories, not app deployment. Some files that you wouldn’t normally put in a repository are useful or essential when you deploy an app.

The rules

Don’t commit the following files and directories created by pub:

.dart_tool/
build/
pubspec.lock  # Except for application packages

Don’t commit the API documentation directory created by dart doc:

doc/api/

Don’t commit files and directories created by other development environments. For example, if your development environment creates any of the following files, consider putting them in a global ignore file:

# IntelliJ
*.iml
*.ipr
*.iws
.idea/

# Mac
.DS_Store

For more details, read on.

Details

As a rule, commit only the files that people need to use your package or source code repository. Including additional files is unnecessary, could be counterproductive, and might have security implications if you expose details about your machine’s setup. In many source code repositories, the common practice is not to commit generated files, at all.

To avoid committing files that are specific to your personal workflow or setup, consider using a global ignore file (for example, .gitignore_global).

When you use pub from within a Git repo, pub ignores the same files that Git does. For example, if you run pub publish from a Git repo that has a .gitignore file containing keys.txt, then your published package won’t contain the keys.txt file.

For more information on .gitignore files, see the GitHub help page Ignoring files.

.dart_tool/

The .dart_tool/ directory contains files used by various Dart tools.

pubspec.lock

The pubspec.lock file is a special case, similar to Ruby’s Gemfile.lock.

For regular packagesdon’t commit the pubspec.lock file. Regenerating the pubspec.lock file lets you test your package against the latest compatible versions of its dependencies.

For application packages, we recommend that you commit the pubspec.lock file. Versioning the pubspec.lock file ensures changes to transitive dependencies are explicit. Each time the dependencies change due to dart pub upgrade or a change in pubspec.yaml the difference will be apparent in the lock file.

  • 21
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Android Studio应用中使用Flutter语言动态获取被点击图片的地址,你可以按照以下步骤进行操作: 1. 在你的Flutter项目中添加image_picker插件。你可以在`pubspec.yaml`文件中添加以下代码: ```yaml dependencies: image_picker: ^0.8.4+4 ``` 2. 在你的Flutter应用程序中使用GestureDetector来监听用户点击图片的事件,并使用image_picker插件来获取被点击图片的地址。 ```dart import 'package:image_picker/image_picker.dart'; GestureDetector( onTap: () async { final pickedFile = await ImagePicker().getImage(source: ImageSource.gallery); if (pickedFile != null) { final String imageUrl = pickedFile.path; // 在这里你可以使用获取到的图片地址进行一些自己的逻辑处理 } }, child: Image.network('https://example.com/image.jpg'), ) ``` 在这个例子中,我们使用了ImagePicker插件来获取用户选择的图片,并将其路径作为字符串返回。你可以在获取到图片路径后进行一些自己的逻辑处理。 3. 如果你需要Android Studio使用Flutter语言来开发原生Android应用程序,你可以按照以下步骤进行操作: - 在Android Studio中安装Flutter插件。你可以在Android Studio的插件中心中搜索Flutter插件并进行安装。 - 创建一个新的Flutter项目,并在项目中添加你需要的插件。 - 在你的Android项目中添加Flutter模块。你可以在Android项目中的`settings.gradle`文件中添加以下代码: ```gradle include ':app' setBinding(new Binding([gradle: this])) evaluate(new File( settingsDir.parentFile, 'path/to/your/flutter_module/.android/include_flutter.groovy' )) ``` - 在你的Android项目中添加FlutterActivity。你可以在Android项目中的`AndroidManifest.xml`文件中添加以下代码: ```xml <activity android:name="io.flutter.embedding.android.FlutterActivity" android:theme="@style/Theme.AppCompat"> <meta-data android:name="flutterEmbedding" android:value="2" /> </activity> ``` 这样,你就可以在Android Studio应用中使用Flutter语言动态获取被点击图片的地址了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值