pinch 1.1.0 pinch: ^1.1.0 copied to clipboard
The PinchSDK is used to collect the neccessary data for allowing you to gain actionable insights through real-time location and behavioural data.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:pinch/pinch.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
Future<List<PinchMessage>> messages;
@override
void initState() {
super.initState();
Pinch.setAdid("ADID");
messages = Pinch.getMessages();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fetch Data Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text('Fetch Data Example'),
),
body: Center(
child: FutureBuilder<List<PinchMessage>>(
future: messages,
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data[0].title);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
// By default, show a loading spinner.
return CircularProgressIndicator();
},
),
),
),
);
}
}