Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rohitsangwan01/pocketbase_server_flutter

Start Pocketbase Server directly from Android/IOS with Flutter
https://github.com/rohitsangwan01/pocketbase_server_flutter

Last synced: 17 days ago
JSON representation

Start Pocketbase Server directly from Android/IOS with Flutter

Awesome Lists containing this project

README

        

# Pocketbase Server Flutter

[![pocketbase_server version](https://img.shields.io/pub/v/pocketbase_server_flutter?label=pocketbase_server_flutter)](https://pub.dev/packages/pocketbase_server_flutter)

Run [Pocketbase](https://pocketbase.io/) Server directly from Android/IOS with flutter

![Screenshot 2023-09-16 at 12 09 12 PM](https://github.com/rohitsangwan01/pocketbase_server_flutter/assets/59526499/4fa49d31-b9f6-4161-8f6b-050c2dea6d2a)

## Usage

Checkout [Pocketbase Server](https://github.com/rohitsangwan01/pocketbase_server_flutter_app) example app

Start pocketbaseServer

```dart
PocketbaseServerFlutter.start(
hostName: await PocketbaseServerFlutter.localIpAddress,
port: "8080",
dataPath: null,
enablePocketbaseApiLogs: true,
);
```

Stop pocketbaseServer

```dart
PocketbaseServerFlutter.stop();
```

Listen to pocketbaseServer events, setup eventCallback

```dart
PocketbaseServerFlutter.setEventCallback(
callback: (event, data){
// Handle event and data
},
);
```

Some helper methods

```dart
// To check if pocketBase is running (not reliable)
PocketbaseServerFlutter.isRunning

// To check pocketbaseMobile version
PocketbaseServerFlutter.pocketbaseMobileVersion

// To get the ipAddress of mobile ( to run pocketbase with this hostname )
PocketbaseServerFlutter.localIpAddress
```

## Setup

- IOS

If getting error related to `Undefined symbol`, Make sure to run `pod install` on ios directory, open IOS project in XCode

Click on `Pods`, Then select `pocketbase_server_flutter` from Targets list, and select `Build Phases`

![Screenshot 2023-09-16 at 11 19 30 AM](https://github.com/rohitsangwan01/pocketbase_server_flutter/assets/59526499/95a13223-252c-4a1d-a0de-4c85fbe32b81)

Then in `Link Binary With Libraries` section, click on `+` button and search for `libresolv.tbd` and choose from result and click on Add

![image](https://github.com/rohitsangwan01/pocketbase_server_flutter/assets/59526499/412fda4d-48b4-44df-88dc-6134c1339518)

- Android

Should work out of the box

## Resources

https://pocketbase.io/

Built with: [pocketbase_mobile](https://github.com/rohitsangwan01/pocketbase_mobile), [pocketbase_android](https://github.com/rohitsangwan01/pocketbase_android
), [pocketbase_ios](https://github.com/rohitsangwan01/pocketbase_ios)

## Note

This is for running Pocketbase server from mobile, to connect with pocketbase server, use official [pockebase](https://pub.dev/packages/pocketbase) client plugin