online PostgreSQL database in flutter app (Dart)



online PostgreSQL database in flutter app (Dart)

online PostgreSQL database in flutter app (Dart)

1. Firstly setup PostgresSQL on (free) Heroku ( https://data.heroku.com/ ) and create database explained in https://youtu.be/Y9lhjKHc39U

2. pubspec.yaml :
————————————–
dev_dependencies:
flutter_test:
sdk: flutter
postgres: ^2.2.0
————————————–

3. $ flutter pub get

4. connection.dart :
————————————–
import ‘package:postgres/postgres.dart’;

Future operation() async {

var connection = PostgreSQLConnection(
“ec2-31-242-24-212.compute-1.amazonaws.com”, // hostURL
5432, // port
“djb7v0k318g55”, // databaseName
username: “ggfplrsgbytwdc”,
password: “b72bf90efb5e5f52b3c22a87f7ef5f76f80e663583”,
useSSL: true
);

await connection.open();
print(“Connected”);
}
————————————–

Comments are closed.