Skip to content

Instantly share code, notes, and snippets.

@slightfoot
Last active December 4, 2024 19:49
Show Gist options
  • Save slightfoot/59b25ab7c775a5e5922fc1a5e87cd402 to your computer and use it in GitHub Desktop.
Save slightfoot/59b25ab7c775a5e5922fc1a5e87cd402 to your computer and use it in GitHub Desktop.
Meetups Database Part 1 - by Simon Lightfoot :: #HumpdayQandA on 4th December 2024 :: https://www.youtube.com/watch?v=l2bnKvuhHe0
// MIT License
//
// Copyright (c) 2024 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
void main() {
runApp(App());
}
class MeetupsDatabase {
MeetupsDatabase._();
late List<MeetupsEntry> entries;
static Future<MeetupsDatabase> create() async {
final instance = MeetupsDatabase._();
await instance.load();
return instance;
}
Future<void> load() async {
final data = await rootBundle.loadString('assets/meetups.jsonl');
final lines = LineSplitter().convert(data);
final entries = <MeetupsEntry>[];
for (final line in lines) {
final map = json.decode(line);
entries.add(MeetupsEntry.fromJson(map));
}
this.entries = entries;
}
}
class MeetupsEntry {
const MeetupsEntry({
required this.link,
required this.name,
required this.location,
});
final String link;
final String name;
final String location;
static MeetupsEntry fromJson(Map<String, dynamic> json) {
return MeetupsEntry(
link: json['link'] as String,
name: json['name'] as String,
location: json['location'] as String,
);
}
}
class App extends StatefulWidget {
const App({super.key});
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
late Future<MeetupsDatabase> _dbFuture;
MeetupsDatabase? database;
@override
void initState() {
super.initState();
_dbFuture = MeetupsDatabase.create().then((db) => database = db);
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: _dbFuture,
builder: (BuildContext context, AsyncSnapshot<MeetupsDatabase> snapshot) {
if (snapshot.connectionState != ConnectionState.done) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Center(
child: CircularProgressIndicator.adaptive(),
),
);
}
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Home(
database: snapshot.requireData,
),
);
},
);
}
}
class Home extends StatelessWidget {
const Home({
super.key,
required this.database,
});
final MeetupsDatabase database;
@override
Widget build(BuildContext context) {
return Material(
child: ListView.builder(
itemCount: database.entries.length,
itemBuilder: (BuildContext context, int index) {
final entry = database.entries[index];
return ListTile(
onTap: (){
print('Open ${entry.link}');
},
title: Text(entry.name),
subtitle: Text(entry.location),
);
},
),
);
}
}
{"link":"https://www.meetup.com/hyderabad-explorers/","name":"Hyderabad Explorers- New in the city","location":"Hyderabad, IN"}
{"link":"https://www.meetup.com/flutter-lille/","name":"Flutter Lille","location":"Lille, FR"}
{"link":"https://www.meetup.com/webapp-builders/","name":"WebApp-Builders Meetup L.A.! Fullstack WebApp Development.","location":"Sherman Oaks, US"}
{"link":"https://www.meetup.com/mobile-rennes/","name":"Mobile Rennes","location":"Rennes, FR"}
{"link":"https://www.meetup.com/gdg-nuremberg/","name":"GDG Nuremberg","location":"Nürnberg, DE"}
{"link":"https://www.meetup.com/ffdgpune/","name":"FlutterFlow Developers Group Pune.","location":"Pune, IN"}
{"link":"https://www.meetup.com/flutter-tallinn/","name":"Flutter Tallinn","location":"Tallinn, EE"}
{"link":"https://www.meetup.com/fluttercwb/","name":"Flutter Curitiba","location":"Curitiba, BR"}
{"link":"https://www.meetup.com/ffdg-bangalore/","name":"FFDG Bangalore","location":"Bangalore, IN"}
{"link":"https://www.meetup.com/meetup-programmez/","name":"Meetup Programmez","location":"Paris, FR"}
{"link":"https://www.meetup.com/flutter-quito/","name":"Flutter Quito","location":"Quito, EC"}
{"link":"https://www.meetup.com/flutter-stavanger/","name":"Flutter Stavanger","location":"Stavanger, NO"}
{"link":"https://www.meetup.com/ffdg-amsterdam/","name":"Flutterflow Developer Group Amsterdam","location":"Amsterdam, NL"}
{"link":"https://www.meetup.com/flutter-wroc%C5%82aw/","name":"Flutter Wrocław","location":"Wroclaw, PL"}
{"link":"https://www.meetup.com/flutter-orebro-meetup-group/","name":"Flutter Örebro","location":"Örebro, SE"}
{"link":"https://www.meetup.com/flutter-chicago/","name":"Flutter Chicago","location":"Chicago, US"}
{"link":"https://www.meetup.com/flutter-sevilla/","name":"Flutter Sevilla","location":"Sevilla, ES"}
{"link":"https://www.meetup.com/flutter-meetup-hamburg/","name":"Flutter Hamburg","location":"Hamburg, DE"}
{"link":"https://www.meetup.com/flutter-leipzig/","name":"Flutter Leipzig","location":"Leipzig, DE"}
{"link":"https://www.meetup.com/flutter-chandigarh/","name":"Flutter Chandigarh","location":"Chandigarh, IN"}
{"link":"https://www.meetup.com/bytes-n-brews/","name":"Bytes & Brews Durbanville - SaaS, Dev and everything 'tween","location":"Durbanville, ZA"}
{"link":"https://www.meetup.com/fluttermontreal/","name":"Flutter Montréal","location":"Montréal, CA"}
{"link":"https://www.meetup.com/flutter/","name":"Flutter LA Meetup","location":"Los Angeles, US"}
{"link":"https://www.meetup.com/debug-camp-melbourne-no-code-builders-meetup-group/","name":"Debug Camp Melbourne - No-Code Builders Meetup Group","location":"Melbourne, AU"}
{"link":"https://www.meetup.com/mumbai-flutter/","name":"Flutter Mumbai","location":"Mumbai, IN"}
{"link":"https://www.meetup.com/ffdg-seoul/","name":"FFDG Seoul","location":"Seoul, KR"}
{"link":"https://www.meetup.com/flutter-community-ibague/","name":"Flutter Community Ibagué","location":"Ibagué, CO"}
{"link":"https://www.meetup.com/flutterisb/","name":"Flutter Islamabad","location":"Islamabad, PK"}
{"link":"https://www.meetup.com/flutter-meetup-group-kisumu/","name":"Flutter Kisumu","location":"Kisumu, KE"}
{"link":"https://www.meetup.com/google-developer-group-cleveland/","name":"Google Developer Group Cleveland","location":"Cleveland, US"}
{"link":"https://www.meetup.com/flutter-riga/","name":"Flutter Riga","location":"Riga, LV"}
{"link":"https://www.meetup.com/gdg-hannover/","name":"GDG Hannover","location":"Hannover, DE"}
{"link":"https://www.meetup.com/ffdg-johannesburg/","name":"FFDG Johannesburg","location":"Johannesburg, ZA"}
{"link":"https://www.meetup.com/gdgnyc/","name":"Google Developer Group (GDG) NYC","location":"New York, US"}
{"link":"https://www.meetup.com/flutter-lodz/","name":"Flutter Łódź","location":"Łódź, PL"}
{"link":"https://www.meetup.com/google-developer-group-mountain-view/","name":"Google Developer Group Mountain View","location":"Mountain View, US"}
{"link":"https://www.meetup.com/flutter-oxford/","name":"Flutter Oxford","location":"Oxford, GB"}
{"link":"https://www.meetup.com/ffdg-guadalajara/","name":"FFDG Guadalajara","location":"Guadalajara, MX"}
{"link":"https://www.meetup.com/ffdg-abidjan/","name":"FFDG Abidjan","location":"Abidjan, CI"}
{"link":"https://www.meetup.com/flutter-la-libertad/","name":"Flutter La Libertad","location":"Trujillo, PE"}
{"link":"https://www.meetup.com/flutter-meetup-graz/","name":"Flutter Graz","location":"Graz, AT"}
{"link":"https://www.meetup.com/ffdg-jaipur/","name":"FFDG Jaipur","location":"Jaipur, IN"}
{"link":"https://www.meetup.com/flutter-montevideo/","name":"Flutter Montevideo","location":"Montevideo, UY"}
{"link":"https://www.meetup.com/sydneymodernapps/","name":"Sydney Modern Apps","location":"Sydney, AU"}
{"link":"https://www.meetup.com/ffdg-bhubaneswar/","name":"FFDG Bhubaneswar","location":"Bhubaneswar, IN"}
{"link":"https://www.meetup.com/flutter-modena/","name":"Flutter Modena","location":"Modena, IT"}
{"link":"https://www.meetup.com/flutter-cracow/","name":"Flutter Cracow","location":"Kraków, PL"}
{"link":"https://www.meetup.com/flutter-malaga/","name":"Flutter Málaga","location":"Málaga, ES"}
{"link":"https://www.meetup.com/qc-flutter/","name":"Flutter Charlotte","location":"Charlotte, US"}
{"link":"https://www.meetup.com/gdg-brisbane/","name":"GDG Brisbane","location":"Brisbane, AU"}
{"link":"https://www.meetup.com/flutter-zurich/","name":"Flutter Zürich","location":"Zürich, CH"}
{"link":"https://www.meetup.com/gdg-ciudad-de-mexico/","name":"Google Developer Group CDMX","location":"México City, MX"}
{"link":"https://www.meetup.com/ffdg-lahore/","name":"FFDG Lahore","location":"Lahore, PK"}
{"link":"https://www.meetup.com/ffdgprayagraj/","name":"FFDG Prayagraj","location":"Allahabad, IN"}
{"link":"https://www.meetup.com/gdg-sydney/","name":"GDG Sydney","location":"Sydney, AU"}
{"link":"https://www.meetup.com/ffdg-berlin/","name":"FFDG Berlin","location":"Berlin, DE"}
{"link":"https://www.meetup.com/fluttervienna/","name":"Flutter Vienna","location":"Vienna, AT"}
{"link":"https://www.meetup.com/san-jose-technology-meetup-group/","name":"GDG San Jose","location":"San Jose, US"}
{"link":"https://www.meetup.com/flutter-faro/","name":"Flutter Faro","location":"Faro, PT"}
{"link":"https://www.meetup.com/flutter-munich/","name":"Flutter Munich","location":"München, DE"}
{"link":"https://www.meetup.com/flutter-kampala/","name":"Flutter Kampala","location":"Kampala, UG"}
{"link":"https://www.meetup.com/flutterahm/","name":"Flutter Ahmedabad","location":"Ahmedabad, IN"}
{"link":"https://www.meetup.com/1337-tech-ljubljana/","name":"tretton37 Tech Ljubljana","location":"Ljubljana, SI"}
{"link":"https://www.meetup.com/flutter-incheon/","name":"Flutter Incheon / 플러터 인천","location":"Incheon, KR"}
{"link":"https://www.meetup.com/fluttervadodara/","name":"Flutter Vadodara","location":"Vadodara, IN"}
{"link":"https://www.meetup.com/flutter-sweden/","name":"Flutter Stockholm","location":"Stockholm, SE"}
{"link":"https://www.meetup.com/flutter-lima/","name":"Flutter Lima","location":"Lima, PE"}
{"link":"https://www.meetup.com/gdg-mons-meetup-group/","name":"GDG MONS","location":"Mons, BE"}
{"link":"https://www.meetup.com/flutter-innsbruck/","name":"Flutter Innsbruck","location":"Innsbruck, AT"}
{"link":"https://www.meetup.com/flutter-los-angeles/","name":"Flutter Los Angeles","location":"Los Angeles, US"}
{"link":"https://www.meetup.com/programmierbar/","name":"programmier.bar: Web- und App-Entwicklung Rhein-Main","location":"Bad Nauheim, DE"}
{"link":"https://www.meetup.com/gdg-denver/","name":"GDG Denver","location":"Denver, US"}
{"link":"https://www.meetup.com/ffdg-vadodara/","name":"FFDG Vadodara","location":"Vadodara, IN"}
{"link":"https://www.meetup.com/ffdg-beirut/","name":"FFDG Beirut","location":"Beirut, LB"}
{"link":"https://www.meetup.com/flutter-paris/","name":"Flutter Paris","location":"Paris, FR"}
{"link":"https://www.meetup.com/flutter-bucharest-meetup/","name":"Flutter Bucharest Meetup","location":"Bucharest, RO"}
{"link":"https://www.meetup.com/ffdg-gandhinagar/","name":"FFDG Gandhinagar","location":"Gandhinagar, IN"}
{"link":"https://www.meetup.com/shortcut-bergen/","name":"Shortcut Bergen","location":"Bergen, NO"}
{"link":"https://www.meetup.com/flutter-perugia/","name":"Flutter Perugia","location":"Perugia, IT"}
{"link":"https://www.meetup.com/ffdg-chennai/","name":"FFDG Chennai","location":"Chennai, IN"}
{"link":"https://www.meetup.com/flutter-austin/","name":"Flutter Austin","location":"Austin, US"}
{"link":"https://www.meetup.com/ffdg-los-angeles/","name":"FlutterFlow Dev/User Group – Los Angeles","location":"Los Angeles, US"}
{"link":"https://www.meetup.com/flutter-lleida/","name":"Flutter Lleida","location":"Lleida, ES"}
{"link":"https://www.meetup.com/flutter-messina/","name":"Flutter Messina","location":"Messina, IT"}
{"link":"https://www.meetup.com/ffdg-brasilia/","name":"FFDG Brasília","location":"Brasília, BR"}
{"link":"https://www.meetup.com/flutter-nantes/","name":"Flutter Nantes","location":"Nantes, FR"}
{"link":"https://www.meetup.com/concord-software-developers/","name":"Concord Software Developers","location":"Concord, US"}
{"link":"https://www.meetup.com/ffdg-munich/","name":"FFDG Munich","location":"München, DE"}
{"link":"https://www.meetup.com/flutter-taipei/","name":"Flutter Taipei","location":"Taipei, TW"}
{"link":"https://www.meetup.com/gdg-barcelona/","name":"Google Developers Group Barcelona","location":"Barcelona, ES"}
{"link":"https://www.meetup.com/ah-technology/","name":"Let's meet at AH Technology","location":"Amsterdam, NL"}
{"link":"https://www.meetup.com/code-beyond/","name":"Code Beyond","location":"Vienna, AT"}
{"link":"https://www.meetup.com/coding-fever-powered-by-adroit-group/","name":"Coding Fever - powered by Adroit Group","location":"Budapest, HU"}
{"link":"https://www.meetup.com/flutter-berlin/","name":"Flutter Berlin","location":"Berlin, DE"}
{"link":"https://www.meetup.com/gdg-zurich/","name":"GDG Zürich","location":"Zürich, CH"}
{"link":"https://www.meetup.com/flutterlahore/","name":"Flutter Lahore","location":"Lahore, PK"}
{"link":"https://www.meetup.com/flutter-silesia/","name":"Flutter Silesia","location":"Katowice, PL"}
{"link":"https://www.meetup.com/flutter-accra/","name":"Flutter Accra","location":"Accra, GH"}
{"link":"https://www.meetup.com/flutter-valencia/","name":"Flutter Valencia","location":"Valencia, ES"}
{"link":"https://www.meetup.com/utah-flutter/","name":"Utah Flutter","location":"American Fork, US"}
{"link":"https://www.meetup.com/flutterkozhikode/","name":"Flutter Kozhikode","location":"Kozhikode, IN"}
{"link":"https://www.meetup.com/ffdg-ahmedabad/","name":"FFDG Ahmedabad","location":"Ahmedabad, IN"}
{"link":"https://www.meetup.com/flutter-kaduna/","name":"Flutter Kaduna","location":"Kaduna, NG"}
{"link":"https://www.meetup.com/ffdg-flutterflow-developer-group-meetup/","name":"FFDG Astana","location":"Astana, KZ"}
{"link":"https://www.meetup.com/flutter-southwest-uk-meetup-group/","name":"Flutter Southwest UK Meetup Group","location":"Bristol, GB"}
{"link":"https://www.meetup.com/meetup-group-axqbiecz/","name":"GDG Lawrence","location":"Lawrence, US"}
{"link":"https://www.meetup.com/flutter-and-friends/","name":"Flutter & Friends – Stockholm's international Flutter conf","location":"Stockholm, SE"}
{"link":"https://www.meetup.com/gdgbrasilia/","name":"GDG Brasília","location":"Brasília, BR"}
{"link":"https://www.meetup.com/gdg-ahmedabad/","name":"GDG Ahmedabad","location":"Ahmedabad, IN"}
{"link":"https://www.meetup.com/android-social-night/","name":"Android Social Night","location":"Toronto, CA"}
{"link":"https://www.meetup.com/flutter-singapore/","name":"Flutter Singapore","location":"Singapore, SG"}
{"link":"https://www.meetup.com/developer-group-ahlen/","name":"Google Developer Group Ahlen","location":"Ahlen, DE"}
{"link":"https://www.meetup.com/fluttersp/","name":"Flutter SP","location":"São Paulo, BR"}
{"link":"https://www.meetup.com/flutter-prague/","name":"Flutter Prague","location":"Prague, CZ"}
{"link":"https://www.meetup.com/flutter-paderborn/","name":"Flutter Paderborn","location":"Paderborn, DE"}
{"link":"https://www.meetup.com/flutter_ica/","name":"Flutter Ica","location":"Ica, PE"}
{"link":"https://www.meetup.com/gdg-linz/","name":"GDG Linz","location":"Linz, AT"}
{"link":"https://www.meetup.com/flutter-voronezh/","name":"Flutter Voronezh","location":"Voronezh, RU"}
{"link":"https://www.meetup.com/flutter-holland/","name":"Flutter Holland","location":"Utrecht, NL"}
{"link":"https://www.meetup.com/lyon-mobile-social-meetup-group/","name":"Flutter Lyon","location":"Lyon, FR"}
{"link":"https://www.meetup.com/flutter-szeged/","name":"Flutter Szeged","location":"Szeged, HU"}
{"link":"https://www.meetup.com/helsinki-flutter-meetup-group/","name":"Helsinki Flutter Meetup Group","location":"Helsinki, FI"}
{"link":"https://www.meetup.com/karlsruhe-flutter-meetup/","name":"Flutter Karlsruhe","location":"Karlsruhe, DE"}
{"link":"https://www.meetup.com/flutter-meetup-group/","name":"Flutter Ottawa","location":"Ottawa, CA"}
{"link":"https://www.meetup.com/flutterldn/","name":"FlutterLDN","location":"London, GB"}
{"link":"https://www.meetup.com/flutter-campinas/","name":"Flutter Campinas","location":"Campinas, BR"}
{"link":"https://www.meetup.com/full-stack-mobile-app-developers-group/","name":"Full-Stack Mobile App Developers Group","location":"Bangalore, IN"}
{"link":"https://www.meetup.com/gdg-nl/","name":"GDG Netherlands","location":"Amsterdam, NL"}
{"link":"https://www.meetup.com/ffdg-tokyo/","name":"FlutterFlow Developer Group Tokyo/Japan","location":"Tokyo, JP"}
{"link":"https://www.meetup.com/flutter-atlanta/","name":"Flutter Atlanta","location":"Atlanta, US"}
{"link":"https://www.meetup.com/flutter-ankara/","name":"Flutter Ankara","location":"Ankara, TR"}
{"link":"https://www.meetup.com/flutter_nairobi/","name":"Flutter Nairobi","location":"Nairobi, KE"}
{"link":"https://www.meetup.com/flutter-melbourne/","name":"Flutter Melbourne","location":"Melbourne, AU"}
{"link":"https://www.meetup.com/flutter-seoul/","name":"Flutter Seoul","location":"Seoul, KR"}
{"link":"https://www.meetup.com/globant-ui-engineering-events/","name":"Globant Engineering Studio","location":"Pune, IN"}
{"link":"https://www.meetup.com/flutter-pune-development-meetup/","name":"Flutter Pune","location":"Pune, IN"}
{"link":"https://www.meetup.com/gdg-darwin/","name":"GDG Darwin","location":"Darwin, AU"}
{"link":"https://www.meetup.com/flutterflow-development-group-tbilisi/","name":"FFDG Tbilisi","location":"Tbilisi, GE"}
{"link":"https://www.meetup.com/gdgauckland/","name":"GDG Auckland","location":"Auckland, NZ"}
{"link":"https://www.meetup.com/flutter-meetup-ecuador/","name":"Flutter Ecuador","location":"Manta, EC"}
{"link":"https://www.meetup.com/flutter-kl/","name":"Flutter KL","location":"Kuala Lumpur, MY"}
{"link":"https://www.meetup.com/calgary-mobile-app-developers-mad/","name":"Calgary Mobile App Developers - MAD","location":"Calgary, CA"}
{"link":"https://www.meetup.com/flutter-ashgabat/","name":"Flutter Ashgabat","location":"Asgabat, TM"}
{"link":"https://www.meetup.com/gdg-melbourne/","name":"GDG Melbourne","location":"Melbourne, AU"}
{"link":"https://www.meetup.com/oslo-flutter-dart-meetup/","name":"Flutter Oslo","location":"Oslo, NO"}
{"link":"https://www.meetup.com/gdg-cape-town-meetup/","name":"GDG Cape Town","location":"Cape Town, ZA"}
{"link":"https://www.meetup.com/flutter-brisbane/","name":"Flutter Brisbane","location":"Brisbane, AU"}
{"link":"https://www.meetup.com/grenoble-web-development-meetup-group/","name":"Grenoble Web Development Meetup Group","location":"Grenoble, FR"}
{"link":"https://www.meetup.com/gdg-hobart/","name":"GDG Hobart","location":"Hobart, AU"}
{"link":"https://www.meetup.com/flutter-belgium/","name":"Flutter Belgium","location":"Brussels, BE"}
{"link":"https://www.meetup.com/flutter-songdo/","name":"Flutter Songdo","location":"Incheon, KR"}
{"link":"https://www.meetup.com/flutter-kathmandu/","name":"Flutter Kathmandu","location":"Kathmandu, NP"}
{"link":"https://www.meetup.com/fluttercolombo/","name":"Flutter Colombo","location":"Colombo, LK"}
{"link":"https://www.meetup.com/meetup-group-drswbuwk/","name":"Flutter-Medellín","location":"Medellín, CO"}
{"link":"https://www.meetup.com/flutter-ogbomosho/","name":"Flutter Ogbomosho","location":"Ogbomosho, NG"}
{"link":"https://www.meetup.com/gdg-adelaide/","name":"GDG Adelaide","location":"Adelaide, AU"}
{"link":"https://www.meetup.com/gdg-perth/","name":"GDG Perth","location":"Perth, AU"}
{"link":"https://www.meetup.com/ffdg-zagreb/","name":"FFDG Zagreb","location":"Zagreb, HR"}
{"link":"https://www.meetup.com/flutter-zg/","name":"Flutter Zagreb","location":"Zagreb, HR"}
{"link":"https://www.meetup.com/flutterjaipur/","name":"Flutter Jaipur","location":"Jaipur, IN"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment