Bhavik Makwana
Oct 7 · 3 min read

Here is the #5 article in this Flutter + Dart Tips series. If you have missed previous articles then you can check them out here.

13. Prefer single quotes for strings

Use double quotes for nested strings or (optionally) for strings that contain single quotes. For all other strings, use single quotes.

final String name = 'Flutter And Dart Tips';print('Hello ${name.split(" ")[0]}');
print('Hello ${name.split(" ")[2]}');

14. Set background image to your Container.

Want to set the background image to your Container? And you are using a Stack to do so? There is a better way to achieve this result. You can use decoration to set the image in the container.

Container(
width: double.maxFinite,
height: double.maxFinite,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage('https://bit.ly/2oqNqj9'),
),
),
child: Center(
child: Text(
'Flutter.dev',
style: TextStyle(color: Colors.red),
),
),
),

You can provide Image according to your need, also you can use the box decoration properties to provide shape and border.

15. Check if release mode or not

You can use kReleaseMode constant to check if the code is running in release mode or not.kReleaseMode is a top-level constant from foundation.dart.

More specifically, this is a constant that is true if the application was compiled in Dart with the ‘-Ddart.vm.product=true’ flag. (from https://api.flutter.dev/flutter/foundation/kReleaseMode-constant.html)

import 'package:flutter/foundation.dart';print('Is Release Mode: $kReleaseMode');

A Tip by Chandu J S


The example shown here are may not be perfect but it is to showcase how you can utilize this while Flutter development.

That’s all for the #5 edition of this series. If you have any tips to share with #Flutterverse then assemble and Start sharing it.

Make a PR in the below repository with your Tip.

You can also write the article for this series on your own if I missed it and publish it at flutter-community.

Thank you Chandu J S for your contribution.


Flutter Community

Articles and Stories from the Flutter Community

Bhavik Makwana

Written by

Flutter Enthusiast | Google Certified Associate Android Developer | Speaker for flutter | Android Dev | Flutter Dev

Flutter Community

Articles and Stories from the Flutter Community

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade