contact_add 0.0.3
contact_add: ^0.0.3 copied to clipboard
Add contacts to Android, iOS or macOS without additional permissions. This is done using native views for the user to complete the contact and save it to the address book.
import 'package:contact_add/contact.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:contact_add/contact_add.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
children: [
ElevatedButton(
onPressed: () async {
await addContact();
},
child: const Text('Add Contact')),
],
),
),
),
);
}
Future<void> addContact() async {
await ContactAdd.addContact(Contact(
firstname: "John",
lastname: "Doe",
company: "ContactAdd",
phone: "+41 01 234 56 78",
email: "hello@example.com"));
}
}