platforms_source_gen 0.0.4 copy "platforms_source_gen: ^0.0.4" to clipboard
platforms_source_gen: ^0.0.4 copied to clipboard

outdated

A Flutter package gen platform's source code, include Android or iOS, Web ....

platforms_source_gen #

A Flutter package gen platform's source code, include Android or iOS, Web ....

Overview #

platforms_source_gen providers utilities from automated source code generation from Dart file.

when you build flutter as a Module in Android, iOS or other platform, you have to write some same function code.

eg: Route Path #

when you dump to a android page, and then you dump to flutter page, and dump to android page...
you can use some package, like flutter_boost:

in android:
#

public class FlutterRoute {
    public static final String android_page1 = "/android/page1";
    public static final String android_page2 = "/android/page2";
    //.......
    public static final String flutter_page1 = "/flutter/page1";
    public static final String flutter_page2 = "/flutter/page2";
    //.......
}

SpreadFragment.build(SpreadFragment::class.java, FlutterRoute.feed)

in flutter:
#

class FlutterRoute {
  static const String android_page1 = "/android/page1";
  static const String android_page2 = "/android/page2";
  //.......
  static const String flutter_page1 = "/flutter/page1";
  static const String flutter_page2 = "/flutter/page2";
  //.......
}

and swift code or js file.....

this tools can help you only write dart code. the platform's code will auto generation.

Quick Start Guide for writing a Generator #

01 Step #

Add a dependency on platforms_source_gen in your pubspec.yaml file and use dart pub get down this package:

dependencies:
  platforms_source_gen: version

if you're only using platforms_source_gen in your own project to generate code and you won't publish your Generator for others to use, it can be a dev_dependency:

dev_dependencies:
  platforms_source_gen: version

the versions click this, more installing info, you can see this

02 Step #

write your dart class file in ./lib/example/example.dart, like this

03 Step #

write a main fun and run:

import 'package:platforms_source_gen/platforms_source_gen.dart';

void main(){
  platforms_source_gen_init("./lib/example/example.dart",//you dart file path
    "com.siyehua.example",//your android's  java class package name
    "./Android_gen" //your android file save path
    );
}

you can find the android file in ./Android_gen

FQA & BUG #

1
likes
0
pub points
34%
popularity

Publisher

unverified uploader

A Flutter package gen platform's source code, include Android or iOS, Web ....

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on platforms_source_gen