my_home_page.dart

I Like Screenshots. Tap Caption For Gists.

As always, I prefer using screenshots in my articles over gists to show concepts rather than just show code. I find them easier to work with frankly. However, you can click or tap on their captions to see the code in a gist or in Github. Tap or click on the screenshots themselves to zoom in on them for a closer look.

No Moving Pictures, No Social Media

There will be gif files in this article demonstrating aspects of the topic at hand. However, it’s said viewing such gif files is not possible when reading this article on platforms like Instagram, Facebook, etc. They may come out as static pictures or simply blank placeholder boxes. Please, be aware of this and maybe read this article on medium.com

Other Stories by Greg Perry
my_home_page.dart
my_home_page.dart
Decode InheritedWidget
my_home_page.dart

Inherit The State

Anyway, you’re not confined to the SetState class either. All that’s needed is to collect a Widget as a dependency to some InheritedWidget somewhere, and you’re then able to achieve spontaneous and meticulous ‘rebuilds’ here and there on your Flutter app’s interface — in my opinion, the only real reason you would ever want to use an InheritedWidget.

page_01.dart
my_home_page.dart
controller.dart

A Meet and Greet

There will be a new greeting every time the counter is divisible by 5. Like with any good design pattern, the Model class will take care of what ‘data’ is provided while the Controller will trigger the response when such an event occurs. And so, with every such divisible count, the function, sayHello(), in the Model class is called. See below.

data_source.dart

Test the Tests

Here’s a neat little exercise. Every time you use a new Dart package, it’s downloaded to your machine, right? On my Windows machine, for example, all the Dart packages I’ve ever used are installed where I installed the Flutter SDK under the following directories, .pub-cache\hosted\pub.dartlang.org\

pubspec.yaml
pubspec.yaml
Run/Debug Configuration in Android Studio

A Test Run

Now, when that’s all done, run it! In the gif file below, you see the integration test is taking the example app through its paces. In the end, your IDE’s console window will display, ‘All tests passed!’ Note, however, there’s some unit testing is going on as well. By convention, you’re to place your integration tests under the directory, integration_test, and your unit tests under the directory, test. See below.

Android Studio

Take A Break

With that all set up, you’re free now to set ‘breakpoints’ in the code and really get an appreciation of the inner workings of the custom package, mvc_pattern. If you don’t use breakpoints much, I feel you should. Again, stepping through your code and utilizing breakpoints in my opinion will only ensure your code is the best it can be.

Made Easy

This framework is to make your life as a developer a little bit easier. The framework works like Flutter because it works with Flutter to supply the Flutter widgets and their objects you already recognize and need to provide a responsive and efficient app. Step through the test code above to understand how to best take advantage of the framework, and by virtue, take advantage of the Flutter framework itself.

Flutter Framework Part 4

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store