Giter VIP home page Giter VIP logo

zubairehman / flutter_boilerplate_project Goto Github PK

View Code? Open in Web Editor NEW
2.2K 80.0 881.0 2.08 MB

A boilerplate project created in flutter using MobX and Provider.

Home Page: http://zubairehman.surge.sh/

License: MIT License

Java 0.10% Dart 66.56% Kotlin 0.10% Ruby 1.87% Swift 1.33% Objective-C 0.03% CMake 12.57% C++ 15.24% C 0.95% HTML 1.25%
flutter dart boilerplate boilerplate-template flutter-boilerplate mobx provider sembast dio validator

flutter_boilerplate_project's Introduction

This branch is still under development

Boilerplate Project

A boilerplate project created in flutter using MobX and Provider. Boilerplate supports both web and mobile, clone the appropriate branches mentioned below:

Getting Started

The Boilerplate contains the minimal implementation required to create a new library or project. The repository code is preloaded with some basic components like basic app architecture, app theme, constants and required dependencies to create a new project. By using boiler plate code as standard initializer, we can have same patterns in all the projects that will inherit it. This will also help in reducing setup & development time by allowing you to use same code pattern and avoid re-writing from scratch.

How to Use

Step 1:

Download or clone this repo by using the link below:

https://github.com/zubairehman/flutter-boilerplate-project.git

Step 2:

Go to project root and execute the following command in console to get the required dependencies:

flutter pub get 

Step 3:

This project uses inject library that works with code generation, execute the following command to generate files:

flutter packages pub run build_runner build --delete-conflicting-outputs

or watch command in order to keep the source code synced automatically:

flutter packages pub run build_runner watch

Hide Generated Files

In-order to hide generated files, navigate to Android Studio -> Preferences -> Editor -> File Types and paste the below lines under ignore files and folders section:

*.inject.summary;*.inject.dart;*.g.dart;

In Visual Studio Code, navigate to Preferences -> Settings and search for Files:Exclude. Add the following patterns:

**/*.inject.summary
**/*.inject.dart
**/*.g.dart

Boilerplate Features:

  • Splash
  • Login
  • Home
  • Routing
  • Theme
  • Dio
  • Database
  • MobX (to connect the reactive data of your application with the UI)
  • Provider (State Management)
  • Encryption
  • Validation
  • Code Generation
  • User Notifications
  • Logging
  • Dependency Injection
  • Dark Theme Support (new)
  • Multilingual Support (new)
  • Provider example (new)

Up-Coming Features:

  • Connectivity Support
  • Background Fetch Support

Libraries & Tools Used

Folder Structure

Here is the core folder structure which flutter provides.

flutter-app/
|- android
|- build
|- ios
|- lib
|- test

Here is the folder structure we have been using in this project

lib/
|- constants/
|- data/
|- stores/
|- ui/
|- utils/
|- widgets/
|- main.dart
|- routes.dart

Now, lets dive into the lib folder which has the main code for the application.

1- constants - All the application level constants are defined in this directory with-in their respective files. This directory contains the constants for `theme`, `dimentions`, `api endpoints`, `preferences` and `strings`.
2- data - Contains the data layer of your project, includes directories for local, network and shared pref/cache.
3- stores - Contains store(s) for state-management of your application, to connect the reactive data of your application with the UI. 
4- ui — Contains all the ui of your project, contains sub directory for each screen.
5- util — Contains the utilities/common functions of your application.
6- widgets — Contains the common widgets for your applications. For example, Button, TextField etc.
7- routes.dart — This file contains all the routes for your application.
8- main.dart - This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.

Constants

This directory contains all the application level constants. A separate file is created for each type as shown in example below:

constants/
|- app_theme.dart
|- dimens.dart
|- endpoints.dart
|- preferences.dart
|- strings.dart

Data

All the business logic of your application will go into this directory, it represents the data layer of your application. It is sub-divided into three directories local, network and sharedperf, each containing the domain specific logic. Since each layer exists independently, that makes it easier to unit test. The communication between UI and data layer is handled by using central repository.

data/
|- local/
    |- constants/
    |- datasources/
    |- app_database.dart
   
|- network/
    |- constants/
    |- exceptions/
    |- rest_client.dart
    
|- sharedpref
    |- constants/
    |- shared_preference_helper.dart
    
|- repository.dart

Stores

The store is where all your application state lives in flutter. The Store is basically a widget that stands at the top of the widget tree and passes it's data down using special methods. In-case of multiple stores, a separate folder for each store is created as shown in the example below:

stores/
|- login/
    |- login_store.dart
    |- form_validator.dart

UI

This directory contains all the ui of your application. Each screen is located in a separate folder making it easy to combine group of files related to that particular screen. All the screen specific widgets will be placed in widgets directory as shown in the example below:

ui/
|- login
   |- login_screen.dart
   |- widgets
      |- login_form.dart
      |- login_button.dart

Utils

Contains the common file(s) and utilities used in a project. The folder structure is as follows:

utils/
|- encryption
   |- xxtea.dart
|- date
  |- date_time.dart

Widgets

Contains the common widgets that are shared across multiple screens. For example, Button, TextField etc.

widgets/
|- app_icon_widget.dart
|- empty_app_bar.dart
|- progress_indicator.dart

Routes

This file contains all the routes for your application.

import 'package:flutter/material.dart';

import 'ui/post/post_list.dart';
import 'ui/login/login.dart';
import 'ui/splash/splash.dart';

class Routes {
  Routes._();

  //static variables
  static const String splash = '/splash';
  static const String login = '/login';
  static const String home = '/post';

  static final routes = <String, WidgetBuilder>{
    splash: (BuildContext context) => SplashScreen(),
    login: (BuildContext context) => LoginScreen(),
    home: (BuildContext context) => HomeScreen(),
  };
}

Main

This is the starting point of the application. All the application level configurations are defined in this file i.e, theme, routes, title, orientation etc.

import 'package:boilerplate/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'constants/app_theme.dart';
import 'constants/strings.dart';
import 'ui/splash/splash.dart';

void main() {
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
    DeviceOrientation.landscapeRight,
    DeviceOrientation.landscapeLeft,
  ]).then((_) {
    runApp(MyApp());
  });
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: Strings.appName,
      theme: themeData,
      routes: Routes.routes,
      home: SplashScreen(),
    );
  }
}

Wiki

Checkout wiki for more info

Conclusion

I will be happy to answer any questions that you may have on this approach, and if you want to lend a hand with the boilerplate then please feel free to submit an issue and/or pull request 🙂

Again to note, this is example can appear as over-architectured for what it is - but it is an example only. If you liked my work, don’t forget to ⭐ star the repo to show your support.

flutter_boilerplate_project's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_boilerplate_project's Issues

issue with flushbar: ^1.9.1

getting issue with flushbar: ^1.9.1, please remove ^ until its fixed by the flushbar,

AndreHaueisen/flushbar#110

Error happens on 1.10,

Compiler message:
../../AppData/Roaming/Pub/Cache/git/flushbar-13c55a888c1693f1c8269ea30d55c614a1bfee16/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has fewer positional arguments than those of overridden method 'OverlayRoute.install'.
  void install() {
       ^
/C:/src/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method ('install').
  void install(OverlayEntry insertionPoint) {
       ^
../../AppData/Roaming/Pub/Cache/git/flushbar-13c55a888c1693f1c8269ea30d55c614a1bfee16/lib/flushbar_route.dart:281:18: Error: Too few positional arguments: 1 required, 0 given.
    super.install();

Adopt pedantic

https://pub.dev/packages/pedantic

This package serves three purposes:

  • It documents how Dart static analysis is used internally at Google, including best practices for the code we write. The documentation is this README.md.
  • It contains a corresponding sample analysis_options.yaml.
  • It contains occasional small snippets of Dart code that are used in implementing those best practices.

flutter pub get error

Direct operation will report an error.
The dependencies in dependency_overrides are not installed correctly.
Do you need any additional operations?

image

Conflict with analyzer library

There appears to be a conflict with the analyzer library being used. No toFunctionValue method... Please advise on how to solve this.

The following error appears when executing the flutter packages pub run build_runner build --delete-conflicting-outputs command:

../../../flutter/.pub-cache/hosted/pub.dartlang.org/source_gen-0.9.4+5/lib/src/constants/revive.dart:22:49: Error: The method 'toFunctionValue' isn't defined for the class 'DartObject'. - 'DartObject' is from 'package:analyzer/dart/constant/value.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.36.4/lib/dart/constant/value.dart').Try correcting the name to the name of an existing method, or defining a method named 'toFunctionValue'. final element = object.type.element ?? object.toFunctionValue();

analyzer dependency is in conflict

Hi, I just clonned the project, and tried get the dependencies. But got this error:

[flutter-boilerplate-project] flutter packages get Running "flutter pub get" in flutter-boilerplate-project... Because every version of inject_generator from git depends on analyzer ^0.34.0 and mobx_codegen >=0.1.3 depends on analyzer ^0.36.3, inject_generator from git is incompatible with mobx_codegen >=0.1.3. So, because boilerplate depends on both mobx_codegen ^0.3.3+1 and inject_generator from git, version solving failed.

As you can see, inject_generator and mobx_codegen have different analyzer versions as dependencies.

Do you have any clue on how to solve this issue?

Thnks

Why use Mobx over RxDart or Provider

A Beginners Question i am still confuse about streams.

As strems are supported with Provider package why we use Mobx or RxDart.

and which is better Mobx or RxDart.

Error: Using 'lib/stores/User/user_store.g.dart'

lib/stores/User/User_store.dart:7:6: Error: Using 'lib/stores/User/user_store.g.dart' as part of 'package:my_project/stores/User/User_store.dart' but its 'part of' declaration says 'package:my_project/stores/User/user_store.dart'.
part 'user_store.g.dart';
     ^
lib/stores/User/User_store.dart:9:35: Error: Type '_$UserStore' not found.
class UserStore = _UserStore with _$UserStore;
                                  ^^^^^^^^^^^
lib/stores/User/User_store.dart:9:7: Error: The type '_$UserStore' can't be mixed in.
class UserStore = _UserStore with _$UserStore;
import 'package:mobx/mobx.dart';
import 'package:my_project/data/repository/user/user_repository.dart';
import 'package:my_project/models/user/user.dart';
import 'package:my_project/models/user/user_list.dart';
import 'package:my_project/stores/error/error_store.dart';

part 'user_store.g.dart';

class UserStore = _UserStore with _$UserStore;

abstract class _UserStore with Store {
  // repository instance
  UserRepository _repository;

...
}

I already run flutter packages pub run build_runner build --delete-conflicting-outputs

The command in step 3 for code generation is slightly wrong.

Hi!
Noticed that the command for building the generated file is slightly wrong, it's missing two "-" for it to properly delete the conflicting outputs. This one works:
flutter packages pub run build_runner watch --delete-conflicting-outputs
As opposed to the command in step 3 which doesn't successfuly delete the conflicting outputs (causing an error for me):
flutter packages pub run build_runner build delete-conflicting-outputs

Hope it helps, thanks for starting this project!

Install

Resolving dependencies... 9.2s

Compiler message:
file:///Users/ashish/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.6.0/lib/flushbar.dart:203:3: Error: Type 'FocusAttachment' not found.
FocusAttachment _focusAttachment;
^^^^^^^^^^^^^^^
file:///Users/ashish/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.6.0/lib/flushbar.dart:203:3: Error: 'FocusAttachment' isn't a type.
FocusAttachment _focusAttachment;
^^^^^^^^^^^^^^^
file:///Users/ashish/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.6.0/lib/flushbar.dart:224:35: Error: The method 'attach' isn't defined for the class 'FocusScopeNode'.

  • 'FocusScopeNode' is from 'package:flutter/src/widgets/focus_manager.dart' ('file:///Users/ashish/Desktop/flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'attach'.
    _focusAttachment = _focusNode.attach(context);
    ^^^^^^
    file:///Users/ashish/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.6.0/lib/flushbar.dart:235:16: Error: The method 'dispose' isn't defined for the class 'FocusScopeNode'.
  • 'FocusScopeNode' is from 'package:flutter/src/widgets/focus_manager.dart' ('file:///Users/ashish/Desktop/flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'dispose'.
    _focusNode.dispose();
    ^^^^^^^
    Compiler failed on /Users/ashish/Desktop/And/f1/boilerplate/lib/main.dart
    Running Gradle task 'assembleDebug'...
    Running Gradle task 'assembleDebug'... Done 40.5s
    Gradle task assembleDebug failed with exit code 1

Unable to build for Web

Hi, first of all, nice work with this repo.
I have a problem where I can't build this for web. I've checked all packages and they are all compatable with Web.

I think the problem is withing LanguageStore and ThemeStore. I've tried to search for the problem but I didn't find any answer so I'm asking here, maybe you know how to fix it.

"flutter-boilerplate-project" is not a valid Dart package name.

I cloned the repo, and want to update android/ios directory, however I got "flutter-boilerplate-project" is not a valid Dart package name. error.

D:\code\flutter\flutter-boilerplate-project>flutter create .
"flutter-boilerplate-project" is not a valid Dart package name.

See https://dart.dev/tools/pub/pubspec#name for more information.

D:\code\flutter\flutter-boilerplate-project>rm -rf android ios

D:\code\flutter\flutter-boilerplate-project>cd ..

D:\code\flutter>mv flutter-boilerplate-project flutter_boilerplate_project

D:\code\flutter>cd flutter_boilerplate_project

D:\code\flutter\flutter_boilerplate_project>flutter create .
Recreating project ....
  .idea\libraries\Dart_SDK.xml (created)
  .idea\libraries\KotlinJavaRuntime.xml (created)
  .idea\modules.xml (created)
  .idea\runConfigurations\main_dart.xml (created)
  .idea\workspace.xml (created)
  android\app\build.gradle (created)
  android\app\src\main\kotlin\com\example\flutter_boilerplate_project\MainActivity.kt (created)
  android\build.gradle (created)
......

Improvement of pubspec.yaml

Hi Zubair,

Firstly, thank you for great work.
I think some dependencies should moved to "dev_dependencies";

  • flutter_launcher_icons
  • mobx_codegen
    Because they won't using in production, we need them only in development.

And I'm wondering why have you defined some dependencies in "dependency_overrides"? When I check it, they aren't defined regular dependencies section. Maybe, move them to "dependencies" will be better.

where sembast is added to project?

I searched all repo and cannot find the place that sembast is added to project!
Of curse it should be pubspec.yaml file, but there isn't too.

Why a central repository?

First of all, thank you @zubairehman and congrats for this awesome project.

I'd like to know why did you choose one central repository strategy? I guess this class will be huge if your domain has lots of domain classes. Why not one repo for each domain class?

Thank you again.

Logins

Hello, where can I find information about login in?

failed to start application

Compiler message:
../../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
void install(OverlayEntry insertionPoint) {
^
../../Flutter_SDK/packages/flutter/lib/src/widgets/routes.dart:40:8: Context: This is the overridden method ('install').
void install() {
^
../../Flutter_SDK/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
super.install(insertionPoint);

Not Pub get Project

Hello

Download your project but when pub get
Getting this Error

The current Dart SDK version is 2.9.2.

Because boilerplate depends on build_runner >=1.10.2 which requires SDK version >=2.10.0-0.0 <3.0.0, version solving failed.
pub get failed (1; Because boilerplate depends on build_runner >=1.10.2 which requires SDK version >=2.10.0-0.0 <3.0.0, version solving failed.)

Error with mobx when run build_runner

Hello, thank you so much for the boilerplate-project,

I'm trying to install the project and I'm getting this error below:
Have you got this error?
Thank you for your help.

Error:

flutter packages pub run build_runner build --delete-conflicting-outputs
[INFO] Generating build script...
[INFO] Generating build script completed, took 511ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 9.0s

[SEVERE] Failed to snapshot build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
[SEVERE] file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:11:7: Error: Found unsupported uses of 'T' in supertype 'NotificationHandlers'.class Interceptors<T>      ^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/listenable.dart:10:7: Error: Found unsupported uses of 'TNotification' in supertype 'NotificationHandlers'.class Listeners<TNotification>      ^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core/observable.dart:49:20: Error: The getter 'hasHandlers' isn't defined for the class 'Listeners<ChangeNotification<T>>'. - 'Listeners' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart'). - 'ChangeNotification' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart').Try correcting the name to the name of an existing getter, or defining a getter or field named 'hasHandlers'.    if (_listeners.hasHandlers) {                   ^^^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core/observable.dart:63:23: Error: The getter 'hasHandlers' isn't defined for the class 'Interceptors<T>'. - 'Interceptors' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart').Try correcting the name to the name of an existing getter, or defining a getter or field named 'hasHandlers'.    if (_interceptors.hasHandlers) {                      ^^^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:14:48: Error: Too many positional arguments: 0 allowed, but 1 found.Try removing the extra positional arguments.  Interceptors(ReactiveContext context) : super(context);                                               ^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:17:52: Error: Method not found: 'add'.  Dispose intercept(Interceptor<T> interceptor) => add(interceptor);                                                   ^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:17:52: Error: The method 'add' isn't defined for the class 'Interceptors<T>'. - 'Interceptors' is from 'package:mobx/src/core.dart' ('file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/core.dart').Try correcting the name to the name of an existing method, or defining a method named 'add'.  Dispose intercept(Interceptor<T> interceptor) => add(interceptor);                                                   ^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:20:10: Error: Method not found: '_canHandle'.    if (!_canHandle(change)) {         ^^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:26:33: Error: Getter not found: '_handlers'.      for (final interceptor in _handlers.toList(growable: false)) {                                ^^^^^^^^^file:///Users/carlos/flutter/.pub-cache/hosted/pub.dartlang.org/mobx-0.1.4/lib/src/interceptable.dart:24:12: Error: Getter not found: '_context'.    return _context.untracked(() {           ^^^^^^^^
pub finished with exit code 78

Provider and Mobx

I am confused with using provider with mobx, can you add an example for it?

Issue with FlushBar arguments

Hey, there's an error with FlushBar install & arguments, know how to fix it ?

Compiler message:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
/C:/src/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method ('install').
  void install() {
       ^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^

Compiler message:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
/C:/src/flutter/packages/flutter/lib/src/widgets/routes.dart:41:8: Context: This is the overridden method ('install').
  void install() {
       ^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

FAILURE: Build failed with an exception.

* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 840

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
Exception: Gradle task assembleDebug failed with exit code 1

exception when navigate to same page

Hello, thank you for the great work first. I am trying your boilerplate and so far so good.
But i got one problem, when i call Navigator to same page, MobXCaughtException came out "setState() or markNeedsBuild() called during build.".

I just add a IconButton in home page

        onPressed: () {
          Navigator.of(context).pushReplacementNamed(Routes.home);
        },
        icon: Icon(
          Icons.power_settings_new,
        ),
      ),

when i press it, exception occurred, how can i solve this problem, thanks.

Nothing happens when doing flutter run

I followed the steps in the readme, I can run other flutter projects without any issues.

Expected
When issuing flutter run I expect to be greeted by the SpashScreen (more specifically the ic_appicon.png)

Actual
No errors or anything nothing just happens.

...
[  +23 ms] Android Debug Bridge version 1.0.41
           Version 29.0.5-5949299
           Installed as /home/knj/Android/Sdk/platform-tools/adb
[   +2 ms] executing: /home/knj/Android/Sdk/platform-tools/adb
start-server
[   +9 ms] Building APK
[  +22 ms] Running Gradle task 'assembleDebug'...
[   +1 ms] gradle.properties already sets `android.enableR8`
[   +2 ms] Using gradle from
/home/knj/flutter-boilerplate-project/android/gradlew.
[   +6 ms] executing: /opt/android-studio/jre/bin/java -version
[  +93 ms] Exit code 0 from: /opt/android-studio/jre/bin/java -version
[        ] openjdk version "1.8.0_202-release"
           OpenJDK Runtime Environment (build
           1.8.0_202-release-1483-b49-5587405)
           OpenJDK 64-Bit Server VM (build 25.202-b49-5587405, mixed
           mode)
[   +3 ms] executing: [/home/knj/flutter-boilerplate-project/android/]
/home/knj/flutter-boilerplate-project/android/gradlew -Pverbose=true
-Ptarget=/home/knj/flutter-boilerplate-project/lib/main.dart
-Ptrack-widget-creation=true -Pfilesystem-scheme=org-dartlang-root
-Ptarget-platform=android-x86 assembleDebug

image

The getter 'externalKeyword' isn't defined for the class 'TopLevelVariableDeclaration'

in running this in mac : flutter packages pub run build_runner build --delete-conflicting-outputs

`Failed to precompile build_runner:build_runner:
../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.3.7/lib/src/source_visitor.dart:2618:21: Error: The getter 'externalKeyword' isn't defined for the class 'TopLevelVariableDeclaration'.

  • 'TopLevelVariableDeclaration' is from 'package:analyzer/dart/ast/ast.dart' ('../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.17/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'externalKeyword'.
    modifier(node.externalKeyword);
    ^^^^^^^^^^^^^^^
    pub finished with exit code 1`

anyone here know's the root cause of this? any help or suggestion is appreciated

Kudos and Questions

That looks super good, I was trying mobx as well and Moor, I was wondering how it will look with the inject.dart. Thanks so much for this. There is only one thing that bothers me

await future.then((postList) {
      this.postList = postList;
    }).catchError((error) {
      errorStore.errorMessage = DioErrorUtil.handleError(error);
    });

if it's in async function shouldn't you just return the future then catch chain and not await them?
If feels weird. I excpect awaits to be wrapped in try catch and not chain then and catch. like this

try { 
this.postList = await _repository.getPosts();
} catch (e) {
errorStore.errorMessage = DioErrorUtil.handleError(error);
}

missing file 'app_component.inject.dart'

Hi there,

Thank u for the awesome work doing this, however I have cloned the repo and I was trying to compile it, and seems that a file is missing, here is a screenshot with the error.

Screen Shot 2019-06-12 at 4 32 20 PM

I would really appreciate if you can help me to fix this issue

URI target doesn't exist

in the page app_component.dart, I can see an issue that is restricting from getting the app compiled.

import 'app_component.inject.dart' as g;

but it is saying invalid URI target for app_component.inject.dart. What might be causing this issue?

app_component.inject.dart No such file

Compiler message:
lib/di/components/app_component.dart:7:8: Error: Error when reading 'lib/di/components/app_component.inject.dart': No such file or directory
import 'app_component.inject.dart' as g;
^
lib/di/components/app_component.dart:20:20: Error: Getter not found: 'AppComponent$Injector'.
return await g.AppComponent$Injector.create(
^^^^^^^^^^^^^^^^^^^^^
Compiler failed on /home/jeanluckabulu/Downloads/flutter-boilerplate-project-master/lib/main.dart

Infinite Loop when trying to build project

Step 3:

This project uses inject library that works with code generation, execute the following command to generate files:

flutter packages pub run build_runner build --delete-conflicting-outputs
or watch command in order to keep the source code synced automatically:

flutter packages pub run build_runner watch

How can we do intercommunication between stores?

I want to access 1 store inside another store.

I find it easier to create a rootStore and pass the rootStore reference to each store.

But how can I do the same with DI architecture used in this project ?

This is my first time using DI, so pardon my lack of experience.

Build_runner compile error

Hi,

Firstly thanks a lot for your boilerplate really nice setup!

I recently came across this error with new version of mobx would you advise any solution ?

`Failed to precompile build_runner:build_runner:
../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1051:25: Error: Type 'ForEachStatement' not found.
visitForEachStatement(ForEachStatement node) {
^^^^^^^^^^^^^^^^
../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1605:19: Error: Type 'MapLiteral' not found.
visitMapLiteral(MapLiteral node) {
^^^^^^^^^^
../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1837:19: Error: Type 'SetLiteral' not found.
visitSetLiteral(SetLiteral node) {
^^^^^^^^^^
../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:506:23: Error: 'MapLiteral' isn't a type.
if (expression is MapLiteral) return false;
^^^^^^^^^^
../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1051:25: Error: 'ForEachStatement' isn't a type.
visitForEachStatement(ForEachStatement node) {
^^^^^^^^^^^^^^^^
../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1218:14: Error: The getter 'initialization' isn't defined for the class 'ForStatement'.

  • 'ForStatement' is from 'package:analyzer/dart/ast/ast.dart' ('../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.10/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'initialization'.
    if (node.initialization != null) {
    ^^^^^^^^^^^^^^
    ../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1219:18: Error: The getter 'initialization' isn't defined for the class 'ForStatement'.
  • 'ForStatement' is from 'package:analyzer/dart/ast/ast.dart' ('../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.10/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'initialization'.
    visit(node.initialization);
    ^^^^^^^^^^^^^^
    ../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1220:21: Error: The getter 'variables' isn't defined for the class 'ForStatement'.
  • 'ForStatement' is from 'package:analyzer/dart/ast/ast.dart' ('../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.10/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'variables'.
    } else if (node.variables != null) {
    ^^^^^^^^^
    ../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1228:30: Error: The getter 'variables' isn't defined for the class 'ForStatement'.
  • 'ForStatement' is from 'package:analyzer/dart/ast/ast.dart' ('../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.10/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'variables'.
    var declaration = node.variables;
    ^^^^^^^^^
    ../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib/src/source_visitor.dart:1241:16: Error: The getter 'leftSeparator' isn't defined for the class 'ForStatement'.
  • 'ForStatement' is from 'package:analyzer/dart/ast/ast.dart' ('../../../Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.39.10/lib/dart/ast/ast.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'leftSeparator'.
    token(node.leftSeparator);`

Add some more screens,repository, store data

Hi,
Your base code is awesome. I was worked for 10 days. It's so hard to find add base repository, store, api register. After I added extra repository, store, api for my project.
I was struggling in store session. Please better to add multiple methods In repository, store and api consuming. It's easy to work some one using this template.
Possible add network listeners, if network not available redirect to network page, unauthorised logout screen, unlimited scrolling with api. I am sure it's really great template for quick development for flutter app development.
Once again, your project quick start is very good.
Kindly consider my request.
Thanks.

Actual use of Provider

Hey,

I don't see an actual use of the Provider package in any of the files. Perhaps you could add a basic example of combining provider with mobx?

update plugin to latest

good project,

but some plugin is too old, for example:

provider: ^1.6.1, the latest is 3.0.0

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.