Today in Mobile:
Building with Kotlin & Flutter
Nenne Adaora ‘Adora’ Nwodo | DevFest Ajah 2018
Slide 2
Slide 2 text
2
Hi, I’m Adora
Full Stack Web Developer
Google Associate Android Developer
Writer, adorahack.com
@theadoranwodo, @adorahack
@adoranwodo
Slide 3
Slide 3 text
1.
More mobile users. Over 65% of
users spend most of their time on
social media apps.
3
2.
Apps for smartwatches, TVs, and
even vehicles now exist. The ‘app
culture’ is becoming dominant.
3.
A typical smartphone user
unlocks their phones over 80
times a day. This generates over
2,700 strokes/swipes per day.
Slide 4
Slide 4 text
Once upon a time...
4
+ = Good
Android
Apps
Slide 5
Slide 5 text
New School
5
+ = Better
Android
Apps
Slide 6
Slide 6 text
Android? How about others?
6
Slide 7
Slide 7 text
JAVA TO KOTLIN
7
1.
Slide 8
Slide 8 text
8
Slide 9
Slide 9 text
▪ Boosts productivity by 100%
▪ Runs on Java JVM
▪ No boilerplate code
▪ Safe
▪ Interoperable
▪ Goodbye, NullPointerException
9
Why move to Kotlin?
Slide 10
Slide 10 text
Less is more
SampleCode.java
public class Person{
private String firstname, lastname;
public Person(String fname, String lname){
this.firstname = fname;
this.lastname = lname;
}
public String getFirstname(){
return firstname;
}
public String getLastname(){
return lastname;
}
Public void setFirstname(string firstname){
this.firstname = firstname;
}
Public void setLastname(string lastname){
this.lastname = lastname;
}
} 10
SampleCode.kt
data class Person(var firstname: String, var lastname:
String)
Slide 11
Slide 11 text
Version 1.1
- JavaScript
- Type aliases
- Sealed and data classes
- also(), takeIf(), takeUnless()
Version 1.2
-Smart cast is better
- Serializable regex
- Java-default
method calls
Version 1.3
- Say hello to code
contracts
- Multiplatform
- Progressive mode
11
Kotlin’s evolution
...
Anko
Library providing a set of Kotlin-friendly wrappers around the Android APIs, as well as a
DSL that lets you replace your layout .xml files with Kotlin code.
Anko Commons, Anko Layouts, Anko SQLite, Anko Coroutines
14
Slide 15
Slide 15 text
15
Who has joined the Kotlin party?
Slide 16
Slide 16 text
IT’S FLUTTER TIME
16
2.
Slide 17
Slide 17 text
Write once, Test
once, Deploy
anywhere
Flutter allows you to build Android & iOS apps from a
single codebase. The Flutter SDK uses Dart.
17
Slide 18
Slide 18 text
18
Not this Dart.
Slide 19
Slide 19 text
An Object Oriented, Class defined language used to build high-quality, multi platform
applications.
Productive, Fast, Portable, Approachable, Reactive
19
Slide 20
Slide 20 text
builder: (BuildContext context) {
return RaisedButton(
onPressed: () => greetAdora(context),
color: Colors.indigoAccent,
child: Text('Say Hi to Adora'),
);
}
20
Slide 21
Slide 21 text
The Flutter Framework
21
Slide 22
Slide 22 text
Flutter Widgets
22
▪ Text
▪ Stack
▪ Container
Slide 23
Slide 23 text
Flutter Widgets
23
▪ Row
▪ Column
Slide 24
Slide 24 text
Flutter Widgets
24
class BigText extends StatelessWidget {
Widget build(context) {
return new Text('text');
}
}
Widgets must have the build method
Slide 25
Slide 25 text
User Interface in Flutter
25
▪ Combine different widgets to build layouts
▪ Stateful widgets
▪ Stateless widgets
▪ Material & Coupertino
▪ Navigation & routing
Slide 26
Slide 26 text
More Flutter
26
▪ Data
▪ State management
▪ Using platform channels
▪ Accessibility Scanner & Accessibility Inspector
▪ Flutter Analyze
▪ Unit tests, Widget tests & Integration tests