Giter Club home page Giter Club logo

flutter_feathersjs.dart's Introduction

FlutterFeathersJs



The road to the feathersjs headquarters https://feathersjs.com/

FlutterFeathersJs is a Flutter package designed to simplify the development of real-time applications using the FeathersJS Node framework. It provides an intuitive API and seamless integration between Flutter and FeathersJS, empowering developers to build powerful and responsive real-time applications with ease.

Features

  • Effortless Integration: Seamlessly connect your Flutter frontend with your FeathersJS backend using FlutterFeathersJs's simple and straightforward API.
  • Real-Time Communication: Utilize FeathersJS's real-time capabilities to create dynamic and interactive Flutter applications.
  • Authentication Support: Authenticate users using email/password or tokens, ensuring secure communication between your Flutter app and FeathersJS server.
  • Socket.io or REST Client: Choose between Socket.io or REST client to suit your project's needs and communication preferences.
  • Event Handling: Leverage FeathersJS's event-driven architecture to handle real-time events and updates efficiently.
  • Scalable and Reliable: Benefit from FeathersJS's scalability options and FlutterFeathersJs's robust design to build reliable real-time applications.

Installation

To start using FlutterFeathersJs, add it to your project's pubspec.yaml file:

dependencies:
  flutter_feathersjs: ^latest_version

Replace latest_version with the latest version of FlutterFeathersJs available on pub.dev.

Then, run the following command in your project's root directory:

flutter pub get

Getting Started

To get started with FlutterFeathersJs, follow these steps:

  1. Import the FlutterFeathersJs package into your Flutter project:

    import 'package:flutter_feathersjs/flutter_feathersjs.dart';
  2. Initialize FlutterFeathersJs as a single instance:

    const BASE_URL = "https://your-feathersjs-server.com";
    
    // Use tools like get_it to initialize FlutterFeathersJs globally across your app
    FlutterFeathersjs flutterFeathersjs = FlutterFeathersjs()..init(baseUrl: BASE_URL);
  3. Authenticate a user using email/password:

    var response = await flutterFeathersjs.authenticate(userName: user["email"], password: user["password"]);
    
    print(response);
  4. Re-authenticate with a token:

    var response = await flutterFeathersjs.reAuthenticate();
    print(response);
  5. Get the authenticated user:

    var response = await flutterFeathersjs.user();
    print(response);

For more detailed usage examples and API documentation, please refer to the FlutterFeathersJs documentation.

Configure and Use Socket.io or REST Client

To configure and use either the Socket.io or REST client, follow the examples below:

Socket.io Client

FlutterFeathersjs socketIOClient = FlutterFeathersjs();

IO.Socket io = IO.io(BASE_URL);

socketIOClient.configure(FlutterFeathersjs.socketioClient(io));

// Authenticate with Socket.io client
var response = await socketIOClient.authenticate(userName: user["email"], password: user["password"]);

print(response);

// Re-authenticate with Socket.io client
var reAuthResponse = await socketIOClient.reAuthenticate();

// Create a message using Socket.io standalone client
var ioResponse = await socketIOClient.service('messages').create({"text": 'A new message'});

// Get the authenticated user
var userResponse = await socketIOClient.user();

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);

// Re-authenticate user using REST client
var reAuthResponse = await restClient.reAuthenticate();

// Call service using REST client
var restResponse = await restClient.service('messages').create({"text": 'A new message'});

// Get the authenticated user
var user = await restClient.user();

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please create a new issue on the issue tracker. Pull requests are also appreciated.

Before contributing, please review our contribution guidelines.

License

This project is licensed under the MIT License.


If you find FlutterFeathersJs useful, consider giving it a star on GitHub and sharing it with your friends and colleagues. Happy coding!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.