Slide 1

Slide 1 text

Introduction to Flutter Muhammed Salih Guler @salihgueler 24.01.2019

Slide 2

Slide 2 text

About me ● Android/Flutter Developer ● Organizer of Flutter Berlin meetup @FlutterBerlin ● Blogger (You can find it here) ● Public speaker ● Mentor @salihgueler 24.01.2019

Slide 3

Slide 3 text

What is Flutter? ● Flutter Google’s cross-platform development SDK ○ Development for iOS and Android. ○ It is available for desktop applications, in the future web applications with Hummingbird ● Single codebase for cross-platform development @salihgueler 24.01.2019

Slide 4

Slide 4 text

What is Flutter? ● It uses Dart Language ○ Dart compiles to ARM and x86 code, so that Dart mobile apps can run natively on iOS, Android, and beyond. ○ Dart provides optimizing ahead-of-time compilation to get predictably high performance and fast startup across mobile devices and the web. ○ It is Reactive @salihgueler 24.01.2019

Slide 5

Slide 5 text

What is Flutter? @salihgueler 24.01.2019 High-level overview Skia Dart Text Foundation Animation Painting Rendering Widgets Material Gestures Engine (C++) Framework (Dart) Cupertino

Slide 6

Slide 6 text

Why should we use Flutter? ● Productivity ○ Creating a multi platform application from single codebase ○ Prototyping and iterating is easy. ○ Hot Reload - Hot Restart ○ Platform Channels ● Design ○ You can use a lot of out of the box widgets from Cupertino or Material libraries ○ Because of it’s 2D rendering engine, create views and animations at 60 fps ● Tools ○ You can use Android Studio, IntelliJ Idea and VSCode @salihgueler 24.01.2019

Slide 7

Slide 7 text

Live Coding Creating a project and showing Hot Reload

Slide 8

Slide 8 text

Widgets ● Everything is a Widget. ● Widgets are the basic building blocks of a Flutter app’s user interface ● They are immutable ● Highly composable ● Inherits the information from parent widget @salihgueler 24.01.2019

Slide 9

Slide 9 text

Stateless Widgets ● A widget that does not require mutable state. A stateless widget is a widget that describes part of the user interface by building a constellation of other widgets that describe the user interface more concretely. @salihgueler 24.01.2019

Slide 10

Slide 10 text

Stateless Widgets @salihgueler 24.01.2019 StatelessWidget constructor build A single StatelessWidget can build in many different BuildContexts

Slide 11

Slide 11 text

Stateful Widgets ● A widget that has mutable state. State is information that can be read synchronously when the widget is built and might change during the lifetime of the widget. It is the responsibility of the widget implementer to ensure that the State is promptly notified when such state changes, using State.setState. @salihgueler 24.01.2019

Slide 12

Slide 12 text

Stateful Widgets ● A widget that has mutable state. State is information that can be read synchronously when the widget is built and might change during the lifetime of the widget. It is the responsibility of the widget implementer to ensure that the State is promptly notified when such state changes, using State.setState. @salihgueler 24.01.2019

Slide 13

Slide 13 text

State @salihgueler 24.01.2019 ● The logic and internal state for a StatefulWidget.

Slide 14

Slide 14 text

(created) initState dispose (dirty) build (clean) didUpdateConfig setState (defunct) A State object can rebuild if ... ... it receives a new configuration … it changes its internal state @salihgueler 24.01.2019

Slide 15

Slide 15 text

Other State Management Methods @salihgueler 24.01.2019 ● Scoped model ● Redux ● BLoC / RxDart

Slide 16

Slide 16 text

Scoped model @salihgueler 24.01.2019 ● It’s a package developed by Brian Egan. ● A set of utilities that allow you to easily pass a data Model from a parent Widget down to it's descendants. In addition, it also rebuilds all of the children that use the model when the model is updated. This library was originally extracted from the Fuchsia codebase.

Slide 17

Slide 17 text

Scoped model @salihgueler 24.01.2019 ● The Model class. You will extend this class to create your own Models, such as SearchModel or UserModel. You can listen to Models for changes! ● The ScopedModel Widget. If you need to pass a Model deep down your Widget hierarchy, you can wrap your Model in a ScopedModel Widget. This will make the Model available to all descendant Widgets. ● The ScopedModelDescendant Widget. Use this Widget to find the appropriate ScopedModel in the Widget tree. It will automatically rebuild whenever the Model notifies that change has taken place.

Slide 18

Slide 18 text

Redux @salihgueler 24.01.2019 ● StoreProvider - The base Widget. It will pass the given Redux Store to all descendants that request it. ● StoreBuilder - A descendant Widget that gets the Store from a StoreProvider and passes it to a Widget builder function. ● StoreConnector - A descendant Widget that gets the Store from the nearest StoreProvider ancestor, converts the Store into a ViewModel with the given converter function, and passes the ViewModel to a builder function. Any time the Store emits a change event, the Widget will automatically be rebuilt. No need to manage subscriptions!

Slide 19

Slide 19 text

BLoC/RxDart @salihgueler 24.01.2019 ● BLoC is a pattern created and used by Google; it will help us to achieve a few things: ○ Separate business logic from presentation logic ○ Embrace the asynchronous nature of UI apps ○ Can be reused across different Dart applications, regardless of being a Flutter app or an Angular Dart application.

Slide 20

Slide 20 text

Community

Slide 21

Slide 21 text

Flutter Community @salihgueler 24.01.2019 ● Medium: http://medium.com/flutter-community/ ● Slack: https://flutterstudygroup.slack.com/ ● Facebook: https://www.facebook.com/FlutterCommunity/ ● Humpday Q&A: https://medium.com/flutter-community/hump-day-q-and-a/home

Slide 22

Slide 22 text

Where to start? @salihgueler 24.01.2019 ● Flutter website: http://flutter.io ● GitHub: https://github.com/flutter ● Samples: http://fluttersamples.com/ ● Medium: Everything :) Jokes aside, (https://medium.com/flutter-io/https-medium-com-flutter-io-pitching-flutter-2d4f494e47d1 And https://hackernoon.com/whats-revolutionary-about-flutter-946915b09514 Really good starts.) ● Udacity course ● Udemy courses

Slide 23

Slide 23 text

Thanks! Twitter: @salihgueler GitHub: @salihgueler Medium: @muhammedsalihguler Email: [email protected] m