flutter_feathersjs 4.1.0-dev flutter_feathersjs: ^4.1.0-dev copied to clipboard
Communicate with your feathers js server from flutter app with unbelieved ease and make happy your customers.
🐦 flutter_feathersjs 🐦 #
Communicate with your feathers js server from flutter app with unbelieved ease and make happy your customers.
Infos: Feathers js is a node framework for real-time applications and REST APIs.
Simple to use #
1. Install it #
# Please see https://pub.dev/packages/flutter_feathersjs/install
flutter_feathersjs: ^lastest
2. Import it #
// Import it
import 'package:flutter_feathersjs/flutter_feathersjs.dart';
3. Initialize it as single instance #
//your api baseUrl
const BASE_URL = "https://flutter-feathersjs.herokuapp.com";
// Init it globally across your app, maybe with get_it or something like that
FlutterFeathersjs flutterFeathersjs = FlutterFeathersjs()..init(baseUrl: BASE_URL);
// Authenticate with email/password
var response = await flutterFeathersjs.authenticate(userName: user["email"], password: user["password"]);
print(response);
// ReAuthenticated with token
var response = await flutterFeathersjs.reAuthenticate();
print(response);
// Get authenticated user
var response = await flutterFeathersjs.user();
4. Configure and use only socketio or rest client #
// Standalone socket io client
FlutterFeathersjs socketIOClient = FlutterFeathersjs();
// Socket.io client
IO.Socket io = IO.io(BASE_URL);
socketIOClient.configure(FlutterFeathersjs.socketioClient(io));
// Auth socketio client
var response = await socketIOClient.authenticate(userName: user["email"], password: user["password"]);
print(response);
// ReAuth socketio client
var reAuthResponse = await socketIOClient.reAuthenticate();
// Create a message using socketio standalone client
var ioResponse = await socketIOClient.service('messages').create({"text": 'A new message'});
// Get the authenticated user
var userResponse = await socketIOClient.user();
//StandAlone rest client
FlutterFeathersjs restClient = FlutterFeathersjs();
Dio dio = Dio(BaseOptions(baseUrl: BASE_URL));
restClient.configure(FlutterFeathersjs.restClient(dio));
// Authenticate user using rest client
var response = await restClient.authenticate( userName: user["email"], password: user["password"]);
print(response);
// Reauthenticate user using rest client
var reAuthResponse = await restClient.reAuthenticate();
// Call service
var restResponse = await restClient.service('messages').create({"text": 'A new message'});
// Get the authenticated user
var user = await restClient.user();
You're ready to go: 3, 2, 1 🚀 Checkout the doc for more info.
Documentation #
Check it out at: https://dahkenangnon.github.io/flutter_feathersjs.dart/
Support #
Please email to dah.kenangnon (at) gmail (dot) com if you have any questions or comments or business support.
Contributing #
Please feel free to contribute to this project by opening an issue or creating a pull request.