[Learn Flutter And Dart To Build IOS And Android Apps

2 views
Skip to first unread message

Raingarda Krzynowek

unread,
Jun 12, 2024, 9:16:10 PM6/12/24
to imtradexbrow

I am interested in learning Flutter. I see that Flutter is based on the Dart language. I am wondering, should I learn Dart first, then get into Flutter, or will I pick up whatever Dart I need to know doing a "Flutter crash course"?

Learn Flutter and Dart to Build iOS and Android Apps


Download ✫✫✫ https://t.co/1dkGBQAUQH



I am not asking anyone to recommend a book or a course. I can find those myself. I am simply asking those experienced with Flutter, if a knowing Dart is a prerequisite to learning Flutter, or if I could just jump into Flutter with minimal working knowledge of Dart.

If you have previous knowledge in any programming language. As I had in java and python, it is much easier to learn a third programming language because you already know one of the most important parts, which is the programming logic.

In case you have no previous knowledge in any programming language. I would say to you, be patient and forget about doing things very fast. It is very hard to understand a plugin right away, even more, one like Flutter which is for mobile development.

In this case, even though you want to be fast. I would recommend you to do a video course which would cover both Dart and Flutter at the same time as this one in Udemy: Learn Flutter & Dart to Build iOS and Android Apps.

But I would strongly suggest you read the entire Dart Documentation from beginning to the end. We are lazy and usually don't like to do that, but really knowing a language documentation saves you a lot of time when developing, remember about when you spent all day long trying to figure it out a bug that was only a coma or a letter that was missing because you didn't know the documentation very well.

In this case, you could dive directly into a Flutter course, you have not too much requirements, this can be fast. You can even get a lot of sample code to use in your app. Remember, you don't have too much requirements you just want to be fast!

But remember,if you don't have time, you don't need to watch all the classes or read the entire documentation. Imagine you want to make a video app like youtube, why would you watch the google maps classes? Therefore, save time by removing what you will not use, but do not save time in the things you are going to use the most.

Bro, don't be lazy. Coding an app is very easy, writing quality code is very hard and few people do. I am an employee in Software Development, already hired more than 20 programmers and I can tell you that most of them were more than 5 years in the career and didn't know how to write quality code. Good code works and any third programmer can understand it.

I will tell what I did. The best way for me is to dive right in. I went into flutter right away. It was bumpy at first with Futures and whatnot, but that's how you learn it fast. I tried making a full fledged app, completely with auth and everything, it was an almost-success. The just to make sure I've covered dart completely I sat and made an AngularDart app since I already knew how Angular works. It was a breeze.

You can dive into Flutter with no knowledge, or a small knowledge of Dart, as long as you understand the structure. But I would strongly encourage a short crash course in Dart regardless of your skill level, as this will allow you to focus on the structure and advantages of Flutter, rather then on interpreting Dart.

The application generates cool-sounding names, such as "newstay", "lightstream", "mainbrake", or "graypine". The user can ask for the next name, favorite the current one, and review the list of favorited names on a separate page. The app is responsive to different screen sizes.

We recommend using VS Code for this codelab because the instructions default to VS Code-specific shortcuts. It's easier to say things like "click here" or "press this key" instead of something like "do the appropriate action in your editor to do X".

For example, say you're using a Windows laptop to develop a Flutter app. If you choose Android as your development target, you typically attach an Android device to your Windows laptop with a USB cable, and your app-in-development runs on that attached Android device. But you could also choose Windows as the development target, which means your app-in-development runs as a Windows app alongside your editor.

Tip: We strongly recommend choosing your development device's Operating System as your development target. So, for example, if your computer runs Windows, choose Windows as the development target.

It might be tempting to select the web as your development target. The downside of this choice is that you lose one of Flutter's most useful development features: Stateful Hot Reload. Flutter can't hot-reload web applications.

The instructions on the Flutter website cover not only the installation of the SDK itself, but also the development target-related tools and the editor plugins. Remember that, for this codelab, you only need to install the following:

This file determines how strict Flutter should be when analyzing your code. Since this is your first foray into Flutter, you're telling the analyzer to take it easy. You can always tune this later. In fact, as you get closer to publishing an actual production app, you will almost certainly want to make the analyzer stricter than this.

First, open lib/main.dart and make sure that you have your target device selected. At the bottom right corner of VS Code, you'll find a button that shows the current target device. Click to change it.

As much fun as it is to watch the Debug Console, you want the button to do something more meaningful. Before getting to that, though, take a closer look at the code in lib/main.dart, to understand how it works.

Next, the MyAppState class defines the app's...well...state. This is your first foray into Flutter, so this codelab will keep it simple and focused. There are many powerful ways to manage app state in Flutter. One of the easiest to explain is ChangeNotifier, the approach taken by this app.

The line responsible for showing the current word pair looks like this now: Text(appState.current.asLowerCase). To change it into something more complex, it's a good idea to extract this line into a separate widget. Having separate widgets for separate logical parts of your UI is an important way of managing complexity in Flutter.

Flutter provides a refactoring helper for extracting widgets but before you use it, make sure that the line being extracted only accesses what it needs. Right now, the line accesses appState, but really only needs to know what the current word pair is.

Instead, select Wrap with Padding. This creates a new parent widget around the Text widget called Padding. After saving, you'll see that the random word already has more breathing room.

This way, widgets can focus on their single responsibility, and you, the developer, have total freedom in how to compose your UI. For example, you can use the Padding widget to pad text, images, buttons, your own custom widgets, or the whole app. The widget doesn't care what it's wrapping.

Notice how the color animates smoothly. This is called an implicit animation. Many Flutter widgets will smoothly interpolate between values so that the UI doesn't just "jump" between states.

Sometimes, though, some work is required. In the case of this app, the screen reader might have problems pronouncing some generated word pairs. While humans don't have problems identifying the two words in cheaphead, a screen reader might pronounce the ph in the middle of the word as f.

A simple solution is to replace pair.asLowerCase with "$pair.first $pair.second". The latter uses string interpolation to create a string (such as "cheap head") from the two words contained in pair. Using two separate words instead of a compound word makes sure that screen readers identify them appropriately, and provides a better experience to visually impaired users.

However, you might want to keep the visual simplicity of pair.asLowerCase. Use Text's semanticsLabel property to override the visual content of the text widget with a semantic content that is more appropriate for screen readers:

First, remember that BigCard is part of a Column. By default, columns lump their children to the top, but we can easily override this. Go to MyHomePage's build() method, and make the following change:

The children are already centered along the column's cross axis (in other words, they are already centered horizontally). But the Column itself isn't centered inside the Scaffold. We can verify this by using the Widget Inspector.

The Widget Inspector itself is beyond the scope of this codelab, but you can see that when the Column is highlighted, it doesn't take up the whole width of the app. It only takes up as much horizontal space as its children need.

Note: Dart has collection types other than List (expressed with []). You could argue that a Set (expressed with ) would make more sense for a collection of favorites. To make this codelab as straightforward as possible, we're sticking with a list. But if you want, you can use a Set instead. The code wouldn't change much.

Here's one way to add the second button to MyHomePage. This time, use the ElevatedButton.icon() constructor to create a button with an icon. And at the top of the build method, choose the appropriate icon depending on whether the current word pair is already in favorites. Also, note the use of SizedBox again, to keep the two buttons a bit apart.

Most apps can't fit everything into a single screen. This particular app probably could, but for didactic purposes, you are going to create a separate screen for the user's favorites. To switch between the two screens, you are going to implement your first StatefulWidget.

Flutter provides several widgets that help you make your apps automatically responsive. For example, Wrap is a widget similar to Row or Column that automatically wraps children to the next "line" (called "run") when there isn't enough vertical or horizontal space. There's FittedBox, a widget that automatically fits its child into available space according to your specifications.

795a8134c1
Reply all
Reply to author
Forward
0 new messages