Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #69

Merged
merged 6 commits into from
Jan 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions example/ios/Flutter/Flutter.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# NOTE: This podspec is NOT to be published. It is only used as a local source!
#

Pod::Spec.new do |s|
s.name = 'Flutter'
s.version = '1.0.0'
s.summary = 'High-performance, high-fidelity mobile apps.'
s.description = <<-DESC
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
DESC
s.homepage = 'https://flutter.io'
s.license = { :type => 'MIT' }
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.vendored_frameworks = 'Flutter.framework'
end
19 changes: 11 additions & 8 deletions lib/flutter_nfc_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,28 @@ class FlutterNfcReader {
return result;
}

static Future<NfcData> read({instruction: String}) async {
final Map data = await _channel.invokeMethod('NfcRead', {
"instruction": instruction
});
static Future<NfcData> read({String instruction}) async {
final Map data = await _callRead(instruction: instruction);
final NfcData result = NfcData.fromMap(data);
return result;
}

static Stream<NfcData> onTagDiscovered({instruction: String}) {
static Stream<NfcData> onTagDiscovered({String instruction}) {
if (Platform.isIOS) {
_channel.invokeMethod('NfcRead', {
"instruction": instruction
});
print("HI");
_callRead(instruction: instruction);
}
return stream.receiveBroadcastStream().map((rawNfcData) {
return NfcData.fromMap(rawNfcData);
});
}

static Future<Map> _callRead({instruction: String}) async {
return await _channel.invokeMethod('NfcRead', <String, dynamic> {
"instruction": instruction
});
}

static Future<NfcData> write(String path, String label) async {
final Map data = await _channel.invokeMethod(
'NfcWrite', <String, dynamic>{'label': label, 'path': path});
Expand Down