SlideShare a Scribd company logo
Welcome to GDG Bronx
Flutter Study Jam 1
Who am I?
Peter Birdsall
presenting …
Birds all Flutter
Start building a tool belt.
Building a Flutter Tool Belt.
Functions and
Methods
Make your reusable methods common as function.
You can just then call it and import them into your
current dart file via Option+Enter
You used to have to type out the import, what a pain!
Method Signatures
Dart method signatures are not polymorphic.
So, only a single Signature But, there are options.
Method Parameter
Defaults
By default all parameters are positional.
A missing parameter can cause a run-time
exception! OH MY!
Making Parameters
Required
Annotation to the rescue.
@required
Makes a constructor parameter to be required via
the IDE.
YourMethodConstructor(
this.key,
@required this.child
…
Parameter Options
There are two options, besides the defaults that you
can apply to parameters.
Optional Parameters - ‘[…]’
Named Parameters - ‘{…}’
Surrounding all or a series of your parameters with
braces ‘{}’ makes them named.
Surrounding all or a series of your parameters with
brackets ‘[]’ makes them optional.
-
Mutually Exclusive
Named and Optional parameters can not be used on
the same parameter(s).
{Named parameters should occur first} and then
[Optional parameters following] if you are going to
use both.
Named Parameters
Named parameters are NOT positional.
Helps make your code more readable.
A common example of Named parameters are in all
of the Widgets supplied by Flutter. So if you used
Flutter your already familiar with them.
Optional and Named
Parameters can be Omitted
This can cause a run-time exception and crash the
app.
OH NO! OH NO! OH NO!
Luckily, there are options
for your Parameter options.
Both Optional and Named parameters can be
assigned default values
YourMethodConstructor({
this.myString = “Default Value”}
Consider your Dart code.
Exceptions can crash your app.
try {
resBody = json.decode(res.body);
} catch (Exception) {
debugPrint(“Exception $Exception”
}
Common Exceptions
FormatException - when a variable doesn’t have the
expected format.
IntegerDivisionByZeroException - oops.
IOException - when a basic Input/Output error
occurs.
Timeout - when a timeout occurs on an async result.
Try Dart’s ‘try’
try {
// code that might have an exception
} on Exception1
//excepton1 code
} catch Exception2 {
//excepton2 code
} finally {
//code that should always execute
}
What’s in your Future?
A Dart ‘Future’ helps asynchronous code feel more
synchronous. It pretty easy.
Two things for Futures
A method calling a future needs be defined as
‘async’ and it returns a ‘Future’ object.
YourMethod() async {…}
Your code that executes an asynchronous function
must be prefaced by ‘await’.
SharedPreferences preferences = await
SharedPreferences.getInstance();
Future processing
An async method always returns a ‘Future’.
A Future with it’s <generic> place holder is initially
created on the call to the ‘await’ method.
Upon completion the Future it’s <generic> type is
returned as Future<T>, or an error if there’s an issue.
The Future is always the
Future, or is it ???
So, you’ve gotten a Future back from your
asynchronous process.
BUT!, I don’t want a Future, I want just the <generic>
or <T>
you can use the ‘.then’
YourAsyncMethod.then((result) {…})
A Future non-Future
example, in the Present?
getUserName.then((userName) { String
myUserName = userName;})
getUserName() async {
SharedPreferences = await
SharedPreferences.getInstance();
String userName = preferences.getString(“User”);
return userName;
}
Global variables
Sharing a variable.
Typically the first thing you hear about is an
InheritedWidget for sharing state to child Widgets,
but this can affect re-drawing of your screen.
How to I share a variable across different screens?
Global variables
- - - 3 Steps - - -
1. Define a library file in Dart, say globals.dart and
add your variables to it.
library global.globals;
bool isTrueGlobalBoolean = false;
2. In your Dart files where you want to use the
‘isTrueGlobalBoolean’ global variable, import it into
your file.
import ‘package:youapp/youdirectory/
globals.dart’ as globals;
Global variables
3rd / Last Step
3. Then you can use the isTrueGlobalBoolean
variable as needed:
print(“${globals.isTrueGlobalBoolean}”);
globals.isTrueGlobalBoolean = true;
Other suggestions
Combine a large set of widgets into a separate;
either Stateful or Stateless custom combined
Widgets.
If you need a custom version of an existing Widget,
you can make a custom version of that widget.
In Android Studio it is useful to use
the Goto Definition Command-b
(Mac) or Ctrl-B (Windows).
Haven’t installed
Flutter yet!
Haven’t installed
Flutter yet!
Ensure your path is setup.

Install Xcode 9.+ so you can use it’s simulator
(Mac or Mac VM only)

Install Android Studio 3.2.1 (No Canary channel)
More details on
medium.com
https://medium.com/flutterpub/start-building-
your-flutter-tool-belt-f48e88ef6a6e
Some of what Flutter
supports:
Material Design

iOS Cupertino Widgets

Gestures

Animation

HTTP and JSON

SQL Database

Shared Preferences

File I/O

Firebase

Firebase Cloud Messaging

(native configs required)

Web View (url launcher)
Flutter Resources
flutter.io

dartlang.org

Google IO 2018

Udacity - https://www.udacity.com/course/build-native-mobile-
apps-with-flutter--ud905

GDG Bronx - Flutter Study Jam

New York Flutter Developer Meetup

GDG Meetups

Udemy

On YouTube:

DartConf 2018

FlutterChallenge

Tensor Programming Flutter
Questions?
Thank You
Linkedin: www.linkedin.com/in/peterjbirdsall

eMail: peter.j.birdsall@gmail.com

Peter Birdsall

More Related Content

What's hot

Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
T11 Sessions
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
Sven Efftinge
 
Advanced Python : Decorators
Advanced Python : DecoratorsAdvanced Python : Decorators
Advanced Python : Decorators
Bhanwar Singh Meena
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
Ben James
 
Advanced Python, Part 1
Advanced Python, Part 1Advanced Python, Part 1
Advanced Python, Part 1
Zaar Hai
 
Python decorators
Python decoratorsPython decorators
Python decorators
Alex Su
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
Giuseppe Arici
 
Swift 2
Swift 2Swift 2
Swift 2
Jens Ravens
 
Python decorators
Python decoratorsPython decorators
Python decorators
Guillermo Blasco Jiménez
 
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
hwilming
 
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Samuel Fortier-Galarneau
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
Julie Iskander
 
Developing iOS apps with Swift
Developing iOS apps with SwiftDeveloping iOS apps with Swift
Developing iOS apps with Swift
New Generation Applications
 
Programming Language Swift Overview
Programming Language Swift OverviewProgramming Language Swift Overview
Programming Language Swift Overview
Kaz Yoshikawa
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design Patterns
Pham Huy Tung
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in Swift
Michele Titolo
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, Swift
Yandex
 
Clean Code Development
Clean Code DevelopmentClean Code Development
Clean Code Development
Peter Gfader
 
Fancy talk
Fancy talkFancy talk
What I Love About Ruby
What I Love About RubyWhat I Love About Ruby
What I Love About Ruby
Keith Bennett
 

What's hot (20)

Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
 
Advanced Python : Decorators
Advanced Python : DecoratorsAdvanced Python : Decorators
Advanced Python : Decorators
 
Decorators in Python
Decorators in PythonDecorators in Python
Decorators in Python
 
Advanced Python, Part 1
Advanced Python, Part 1Advanced Python, Part 1
Advanced Python, Part 1
 
Python decorators
Python decoratorsPython decorators
Python decorators
 
Swift Programming Language
Swift Programming LanguageSwift Programming Language
Swift Programming Language
 
Swift 2
Swift 2Swift 2
Swift 2
 
Python decorators
Python decoratorsPython decorators
Python decorators
 
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
Exploring Ceylon with Gavin King - JUG BB Talk - Belrin 2014
 
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
Decorators Explained: A Powerful Tool That Should Be in Your Python Toolbelt.
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Developing iOS apps with Swift
Developing iOS apps with SwiftDeveloping iOS apps with Swift
Developing iOS apps with Swift
 
Programming Language Swift Overview
Programming Language Swift OverviewProgramming Language Swift Overview
Programming Language Swift Overview
 
Javascript Common Design Patterns
Javascript Common Design PatternsJavascript Common Design Patterns
Javascript Common Design Patterns
 
Cocoa Design Patterns in Swift
Cocoa Design Patterns in SwiftCocoa Design Patterns in Swift
Cocoa Design Patterns in Swift
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, Swift
 
Clean Code Development
Clean Code DevelopmentClean Code Development
Clean Code Development
 
Fancy talk
Fancy talkFancy talk
Fancy talk
 
What I Love About Ruby
What I Love About RubyWhat I Love About Ruby
What I Love About Ruby
 

Similar to Bronx study jam 1

Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
David McCarter
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
Yakov Fain
 
Clean code
Clean codeClean code
Clean code
Khou Suylong
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
ciklum_ods
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
Ying Zhang
 
Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.
Alberto Naranjo
 
Esoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basicsEsoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basics
Rasan Samarasinghe
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
JWORKS powered by Ordina
 
Effecient javascript
Effecient javascriptEffecient javascript
Effecient javascript
mpnkhan
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
Matthias Noback
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
Jeff Durta
 
Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIs
Dmitry Buzdin
 
Writing JavaScript that doesn't suck
Writing JavaScript that doesn't suckWriting JavaScript that doesn't suck
Writing JavaScript that doesn't suck
Ross Bruniges
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014
Matthias Noback
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
James Williams
 
Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docx
audeleypearl
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
iPhone Seminar Part 2
iPhone Seminar Part 2iPhone Seminar Part 2
iPhone Seminar Part 2
NAILBITER
 
Best Coding Practices For Android Application Development
Best Coding Practices For Android Application DevelopmentBest Coding Practices For Android Application Development
Best Coding Practices For Android Application Development
Ketan Raval
 
Supercharge Flutter declarative UI with code generation
Supercharge Flutter declarative UI with code generationSupercharge Flutter declarative UI with code generation
Supercharge Flutter declarative UI with code generation
Emanuele Papa
 

Similar to Bronx study jam 1 (20)

Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Clean code
Clean codeClean code
Clean code
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
 
Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.Javascript quiz. Questions to ask when recruiting developers.
Javascript quiz. Questions to ask when recruiting developers.
 
Esoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basicsEsoft Metro Campus - Certificate in java basics
Esoft Metro Campus - Certificate in java basics
 
Unit testing - A&BP CC
Unit testing - A&BP CCUnit testing - A&BP CC
Unit testing - A&BP CC
 
Effecient javascript
Effecient javascriptEffecient javascript
Effecient javascript
 
The Naked Bundle - Tryout
The Naked Bundle - TryoutThe Naked Bundle - Tryout
The Naked Bundle - Tryout
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Developing Useful APIs
Developing Useful APIsDeveloping Useful APIs
Developing Useful APIs
 
Writing JavaScript that doesn't suck
Writing JavaScript that doesn't suckWriting JavaScript that doesn't suck
Writing JavaScript that doesn't suck
 
The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014The Naked Bundle - Symfony Live London 2014
The Naked Bundle - Symfony Live London 2014
 
Introduction to Griffon
Introduction to GriffonIntroduction to Griffon
Introduction to Griffon
 
Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docx
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
 
iPhone Seminar Part 2
iPhone Seminar Part 2iPhone Seminar Part 2
iPhone Seminar Part 2
 
Best Coding Practices For Android Application Development
Best Coding Practices For Android Application DevelopmentBest Coding Practices For Android Application Development
Best Coding Practices For Android Application Development
 
Supercharge Flutter declarative UI with code generation
Supercharge Flutter declarative UI with code generationSupercharge Flutter declarative UI with code generation
Supercharge Flutter declarative UI with code generation
 

Recently uploaded

Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 

Recently uploaded (20)

Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 

Bronx study jam 1

  • 1. Welcome to GDG Bronx Flutter Study Jam 1
  • 2. Who am I? Peter Birdsall presenting …
  • 3. Birds all Flutter Start building a tool belt.
  • 4. Building a Flutter Tool Belt.
  • 5. Functions and Methods Make your reusable methods common as function. You can just then call it and import them into your current dart file via Option+Enter You used to have to type out the import, what a pain!
  • 6. Method Signatures Dart method signatures are not polymorphic. So, only a single Signature But, there are options.
  • 7. Method Parameter Defaults By default all parameters are positional. A missing parameter can cause a run-time exception! OH MY!
  • 8. Making Parameters Required Annotation to the rescue. @required Makes a constructor parameter to be required via the IDE. YourMethodConstructor( this.key, @required this.child …
  • 9. Parameter Options There are two options, besides the defaults that you can apply to parameters. Optional Parameters - ‘[…]’ Named Parameters - ‘{…}’ Surrounding all or a series of your parameters with braces ‘{}’ makes them named. Surrounding all or a series of your parameters with brackets ‘[]’ makes them optional. -
  • 10. Mutually Exclusive Named and Optional parameters can not be used on the same parameter(s). {Named parameters should occur first} and then [Optional parameters following] if you are going to use both.
  • 11. Named Parameters Named parameters are NOT positional. Helps make your code more readable. A common example of Named parameters are in all of the Widgets supplied by Flutter. So if you used Flutter your already familiar with them.
  • 12. Optional and Named Parameters can be Omitted This can cause a run-time exception and crash the app. OH NO! OH NO! OH NO!
  • 13. Luckily, there are options for your Parameter options. Both Optional and Named parameters can be assigned default values YourMethodConstructor({ this.myString = “Default Value”}
  • 14. Consider your Dart code. Exceptions can crash your app. try { resBody = json.decode(res.body); } catch (Exception) { debugPrint(“Exception $Exception” }
  • 15. Common Exceptions FormatException - when a variable doesn’t have the expected format. IntegerDivisionByZeroException - oops. IOException - when a basic Input/Output error occurs. Timeout - when a timeout occurs on an async result.
  • 16. Try Dart’s ‘try’ try { // code that might have an exception } on Exception1 //excepton1 code } catch Exception2 { //excepton2 code } finally { //code that should always execute }
  • 17. What’s in your Future? A Dart ‘Future’ helps asynchronous code feel more synchronous. It pretty easy.
  • 18. Two things for Futures A method calling a future needs be defined as ‘async’ and it returns a ‘Future’ object. YourMethod() async {…} Your code that executes an asynchronous function must be prefaced by ‘await’. SharedPreferences preferences = await SharedPreferences.getInstance();
  • 19. Future processing An async method always returns a ‘Future’. A Future with it’s <generic> place holder is initially created on the call to the ‘await’ method. Upon completion the Future it’s <generic> type is returned as Future<T>, or an error if there’s an issue.
  • 20. The Future is always the Future, or is it ??? So, you’ve gotten a Future back from your asynchronous process. BUT!, I don’t want a Future, I want just the <generic> or <T> you can use the ‘.then’ YourAsyncMethod.then((result) {…})
  • 21. A Future non-Future example, in the Present? getUserName.then((userName) { String myUserName = userName;}) getUserName() async { SharedPreferences = await SharedPreferences.getInstance(); String userName = preferences.getString(“User”); return userName; }
  • 22. Global variables Sharing a variable. Typically the first thing you hear about is an InheritedWidget for sharing state to child Widgets, but this can affect re-drawing of your screen. How to I share a variable across different screens?
  • 23. Global variables - - - 3 Steps - - - 1. Define a library file in Dart, say globals.dart and add your variables to it. library global.globals; bool isTrueGlobalBoolean = false; 2. In your Dart files where you want to use the ‘isTrueGlobalBoolean’ global variable, import it into your file. import ‘package:youapp/youdirectory/ globals.dart’ as globals;
  • 24. Global variables 3rd / Last Step 3. Then you can use the isTrueGlobalBoolean variable as needed: print(“${globals.isTrueGlobalBoolean}”); globals.isTrueGlobalBoolean = true;
  • 25. Other suggestions Combine a large set of widgets into a separate; either Stateful or Stateless custom combined Widgets. If you need a custom version of an existing Widget, you can make a custom version of that widget. In Android Studio it is useful to use the Goto Definition Command-b (Mac) or Ctrl-B (Windows).
  • 27. Haven’t installed Flutter yet! Ensure your path is setup. Install Xcode 9.+ so you can use it’s simulator (Mac or Mac VM only) Install Android Studio 3.2.1 (No Canary channel)
  • 29. Some of what Flutter supports: Material Design iOS Cupertino Widgets Gestures Animation HTTP and JSON SQL Database Shared Preferences File I/O Firebase Firebase Cloud Messaging (native configs required) Web View (url launcher)
  • 30. Flutter Resources flutter.io dartlang.org Google IO 2018 Udacity - https://www.udacity.com/course/build-native-mobile- apps-with-flutter--ud905 GDG Bronx - Flutter Study Jam New York Flutter Developer Meetup GDG Meetups Udemy On YouTube: DartConf 2018 FlutterChallenge Tensor Programming Flutter
  • 32. Thank You Linkedin: www.linkedin.com/in/peterjbirdsall eMail: peter.j.birdsall@gmail.com Peter Birdsall