Skip to content

hokamc/raccoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raccoon

Raccoon

Maintenance Status

A complete and powerful flutter framework

Table of Contents

Dependency Injection

The design of dependency injection is simply a global map. It is very easy to use.

class Bloc {
    final value = 0;
}

class AppModule extends Module {
    @override
    Future<void> initial() async {
      bind(Bloc());
    }

    @override
    Widget build(BuildContext context) {
      Bloc bloc = inject();
      return Container();      
    }
}

Module

To bind your dependencies, you just need to create a module subclass. This class would help you to handle the lifecycle of dependencies.

inject

To get the dependency, you can simply call inject(). The dependency will be kept until the module class is disposed.

State management

Although stream is used to manage state, the usage is still as simple as ScopedModel.

class ColorBloc implements Disposable {
    final Data<Color> c1 = Data(Colors.red);
    final Data<Color> c2 = Data(Colors.blue);

    void changeColor() {
      c1.push(Color(Random().nextInt(0xFFFFFFFF)));
      c2.push(Color(Random().nextInt(0xFFFFFFFF)));
    } 

    @override
    void dispose() {
      c1.dispose();
      c2.dispose();
    }
}

Data

Data is wrapper of stream. You can update value by push() new value. Also, it exposes two fields including a cache value and a stream, so you are free to get latest value easily and listen to stream with your handler as you like. Remember to dispose every data.

Firebase Integration

Although most services of firebase are very expensive, there are few stuffs including analysis, crashlysis, performance and remote config, which are great to use and totally free of charge. These tools help us to monitor and debug the application conveniently.

All of them are integrated into our framework, please follow the set up in order to enable these features.

Android Set Up

android/build.gradle

dependencies {
    classpath 'com.google.gms:google-services:4.3.3'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
    // ...  

android/app/build.gradle

defaultConfig {
    // ...
    multiDexEnabled true
    // ...        

dependencies {
    // temporary fix for upstream bug from android sdk
    implementation 'com.google.firebase:firebase-analytics:18.0.0'
    implementation 'com.google.android.gms:play-services-basement:17.5.0'
    // ...

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

Logger

Localization

Util

Responsiveness

Todo

Authors

About

A complete and powerful flutter framewok

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages