SlideShare uma empresa Scribd logo
1 de 65
Baixar para ler offline
) Woowahan Bros. / Baemin Market Mobile platform Development
HydaiCapital / Mobile Platform Development
SOCAR Mobile Developer / Mobile , Tablet
DreamPlus with Hanwha S&C / ZUMO Application
Lassoh inc. (Toronto in Canada) / Mobile SNS platform
Samsung Mobile Group / .
Flutter is Google's mobile UI framework
Flutter
Fast Beautiful
OpenProductive
Flutter
Fast Beautiful
OpenProductive
Flutter
Fast Beautiful
OpenProductive
Flutter
Fast Beautiful
OpenProductive
Flutter
Fast Beautiful
OpenProductive
Flutter
v1.7
The First Release
2,366
Watch
71,268
Stars
8,432
Forks
421
Contributors
Native Code
Widgets,
Rendering
Platform
Channels
Canvas
Events
Location Bluetooth
Audio Sensors
Camera Etc.
Service
Platform
Application
Native Code
Widgets,
Rendering
Platform
Channels
Canvas
Events
Location Bluetooth
Audio Sensors
Camera Etc.
Service
Platform
Application
Use Platform Channels
Platform channels are the gateway to accessing
platform-specific code in Flutter.
What do I mean by platform-specific?
Access to device inputs
Secure storage (a.k.a. keychain on iOS)
The Basic building block for
creating plugins
MyOS Call Device State Camera Check
Options :
1. Use Plugins
2. Write platform-specific code
description: A new Flutter application.
dependencies:
core:
path: ../core
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
xml: ^3.0.0
flutter_redux: ^0.5.0
intl: ^0.15.2
url_launcher: ^3.0.0
path_provider: ^0.4.0
key_value_store_flutter: ^1.0.0
....
....
MethodChannel class is defined
inside the ‘service’ package.
import 'package:flutter/services.dart';
import 'dart:async';
Need to import the ‘async’ package to support async features in our dart codebase.
static const channel =
const MethodChannel('tryflutter.github.io/flutter_BabyStep');
To define MethodChannel in dart we use :
Like this…
You can name it  anything, but the best practice is to name
it domain_name/channel_name. 
final response = await channel.invokeMethod(message, [optional_arguments])
You can name it  anything, but the best practice is to name
it domain_name/channel_name. 
Future<Null> _showDialog() async {
final response =
await channel.invokeMethod("showDialog", ["Called From Flutter"]);
final snackbar = new SnackBar(content: new Text(response));
Scaffold.of(context).showSnackBar(snackbar);
}
Future<Null> _openNewPage() async {
final response =
await channel.invokeMethod("openPage", ["Hi From Flutter"]);
print(response);
}
Future<Null> _requestNetwork() async {
final response = await channel.invokeMethod(
"request", ["https://www.thesportsdb.com/api/v1/json/1/"]);
Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new SecondRoute(data: response),
),
);
}
class MainActivity : FlutterActivity() {
...
}
val channel = MethodChannel(flutterView, "tryflutter.github.io/
platformchannel”)
channel.setMethodCallHandler { methodCall, result ->
val args = methodCall.arguments as List<*>
val param = args.first() as String
when (methodCall.method) {
"openPage" -> openSecondActivity(param)
"showDialog" -> showDialog(param, result)
"request" -> callService(param, result)
else -> return@setMethodCallHandler
}
}
private fun openSecondActivity(info: String) {
startActivity<SecondActivity>("info" to info)
}
private fun showDialog(content: String, channelResult:
MethodChannel.Result) {
MaterialDialog.Builder(this).title("Native Dialog").theme(Theme.LIGHT)
.content(content)
.positiveText("Ok")
.negativeText("Cancel")
.onPositive { _, _ -> channelResult.success("Ok was
clicked") }
.onNegative { _, _ -> channelResult.success("Cancel was
clicked") }
.show()
}
private fun callService(url: String, channelResult: MethodChannel.Result) {
...
service.getEPLTeams().enqueue(object : Callback<TeamResponse> {
override fun onFailure(call: Call<TeamResponse>?, t: Throwable?) {
channelResult.error("FAILURE", "CALL FAILED", t?.localizedMessage)
}
override fun onResponse(call: Call<TeamResponse>?, response:
Response<TeamResponse>?) {
channelResult.success(Gson().toJson(response?.body()?.teams))
}
})
}
DEMO
Q & A
.

Mais conteúdo relacionado

Mais procurados

G W T(2)
G W T(2)G W T(2)
G W T(2)
tomcoh
 

Mais procurados (19)

Flutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for businessFlutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for business
 
Griffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java TechnologyGriffon: Re-imaging Desktop Java Technology
Griffon: Re-imaging Desktop Java Technology
 
Flutter
FlutterFlutter
Flutter
 
Let’s talk about star wars with Dialog Flow
Let’s talk about star wars with Dialog FlowLet’s talk about star wars with Dialog Flow
Let’s talk about star wars with Dialog Flow
 
Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020Flutter workshop @ bang saen 2020
Flutter workshop @ bang saen 2020
 
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
 [INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno [INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
[INNOVATUBE] Tech Talk #3: Golang - Takaaki Mizuno
 
Flutter for web
Flutter for webFlutter for web
Flutter for web
 
Flutter
FlutterFlutter
Flutter
 
Android Development with Kotlin course
Android Development  with Kotlin courseAndroid Development  with Kotlin course
Android Development with Kotlin course
 
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
Android on Windows 11 - A Developer's Perspective (Windows Subsystem For Andr...
 
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
Introduction to Python GUI development with Delphi for Python - Part 1:   Del...Introduction to Python GUI development with Delphi for Python - Part 1:   Del...
Introduction to Python GUI development with Delphi for Python - Part 1: Del...
 
Python for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 IntroductionPython for Delphi Developers - Part 1 Introduction
Python for Delphi Developers - Part 1 Introduction
 
Developing for the BlackBerry PlayBook using Flex Builder Burrito
Developing for the BlackBerry PlayBook using Flex Builder BurritoDeveloping for the BlackBerry PlayBook using Flex Builder Burrito
Developing for the BlackBerry PlayBook using Flex Builder Burrito
 
Android and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
Android and OSGi Can They Work Together - BJ Hargrave & Neil BartlettAndroid and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
Android and OSGi Can They Work Together - BJ Hargrave & Neil Bartlett
 
G W T(2)
G W T(2)G W T(2)
G W T(2)
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworks
 
Study Jam: Android for Beginners, Summary
Study Jam: Android for Beginners, SummaryStudy Jam: Android for Beginners, Summary
Study Jam: Android for Beginners, Summary
 
Silverlight 2 with Visual Studio 2008 and Expression Blend
Silverlight 2 with Visual Studio 2008 and Expression BlendSilverlight 2 with Visual Studio 2008 and Expression Blend
Silverlight 2 with Visual Studio 2008 and Expression Blend
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 

Semelhante a Flutter 에서 Native(iOS, Android) 코드와 통신하기

Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 

Semelhante a Flutter 에서 Native(iOS, Android) 코드와 통신하기 (20)

Communication between Flutter and native modules Baby Step
Communication between Flutter  and native modules Baby StepCommunication between Flutter  and native modules Baby Step
Communication between Flutter and native modules Baby Step
 
Cross platform mobile apps using .NET
Cross platform mobile apps using .NETCross platform mobile apps using .NET
Cross platform mobile apps using .NET
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
mobl
moblmobl
mobl
 
Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition!
Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition! Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition!
Battle Of The Microservice Frameworks: Micronaut versus Quarkus edition!
 
Introduction to flutter
Introduction to flutterIntroduction to flutter
Introduction to flutter
 
The unconventional devices for the Android video streaming
The unconventional devices for the Android video streamingThe unconventional devices for the Android video streaming
The unconventional devices for the Android video streaming
 
Calabash-android
Calabash-androidCalabash-android
Calabash-android
 
Google Wave API: Now and Beyond
Google Wave API: Now and BeyondGoogle Wave API: Now and Beyond
Google Wave API: Now and Beyond
 
The unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidThe unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in Android
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W... 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
 
Flutter vs Java Graphical User Interface Frameworks.pptx
Flutter vs Java Graphical User Interface Frameworks.pptx Flutter vs Java Graphical User Interface Frameworks.pptx
Flutter vs Java Graphical User Interface Frameworks.pptx
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
 
Eddystone beacons demo
Eddystone beacons demoEddystone beacons demo
Eddystone beacons demo
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
JCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop LabsJCConf 2016 - Dataflow Workshop Labs
JCConf 2016 - Dataflow Workshop Labs
 
Developing in android
Developing in androidDeveloping in android
Developing in android
 
[ABC2018Spring]Flutterアプリ開発入門
[ABC2018Spring]Flutterアプリ開発入門[ABC2018Spring]Flutterアプリ開発入門
[ABC2018Spring]Flutterアプリ開発入門
 
[Droidcon Paris 2013]Multi-Versioning Android Tips
[Droidcon Paris 2013]Multi-Versioning Android Tips[Droidcon Paris 2013]Multi-Versioning Android Tips
[Droidcon Paris 2013]Multi-Versioning Android Tips
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Flutter 에서 Native(iOS, Android) 코드와 통신하기