Skip to content

Instantly share code, notes, and snippets.

View M97Chahboun's full-sized avatar
🏠
Working from home

Mohammed CHAHBOUN M97Chahboun

🏠
Working from home
View GitHub Profile
@M97Chahboun
M97Chahboun / flutter_github_ci.yml
Created June 5, 2022 02:52 — forked from rodydavis/flutter_github_ci.yml
Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_web:
import 'package:mvc_rocket/mvc_rocket.dart';
const String postUserIdKey = "userId";
const String postIdKey = "id";
const String postTitleKey = "title";
const String postBodyKey = "body";
class Post extends RocketModel<Post> {
int? userId;
int? id;
import 'package:example/models/post_model.dart';
import 'package:mvc_rocket/mvc_rocket.dart';
const String postsEndpoint = "posts";
class PostRequests {
static Future getPosts(Post postModel) =>
RocketController().get(rocketRequestKey).getObjData(
// endpoint
postsEndpoint,
import 'dart:io';
import 'package:example/models/post_model.dart';
import 'package:example/requests/post_request.dart';
import 'package:flutter/material.dart';
import 'package:mvc_rocket/mvc_rocket.dart';
class PostExample extends StatelessWidget {
// Save your model to use on another screen
// readOnly means if you close and open this screen you will use same data without update it from Api
// Set it in first screen
const String baseUrl = 'https://jsonplaceholder.typicode.com';
// create request object
RocketRequest request = RocketRequest(url: baseUrl);
// save it, for use it from any screen
rocket.add(rocketRequestKey, request);
// inside of object use rocket extension 
RocketController().add("key",value,readOnly:true); // you can't edit it if readonly true
// or
// [add] return value
rocket.add<Type>("key",value);
// [get] return value
rocket.get<Type>("key");
// [remove]
rocket.remove("key");
// remove with condition
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:mvc_rocket/mvc_rocket.dart';
class MiniView extends StatelessWidget {
MiniView({Key? key, required this.title}) : super(key: key);
final String title;
// use mini for convert value to RocketValue
final RocketValue<String> mcString = "Initial value".mini;
import 'dart:io';
const List<String> options = ["major", "minor", "patch"];
Future<void> main(List<String> labels) async {
List<String> versionParts = List.from(labels);
versionParts.removeWhere((e) => !options.contains(e));
String parts = "";
if (versionParts.isNotEmpty) {
parts = versionParts.join(",");
parts = "parts=bump:$parts";
name: Bump app version based on PR labels
# Workflow for every new feature/enhance/fix
on:
pull_request:
branches:
- dev
types:
- closed
jobs:
setup_dart_and_run_converter:
- name: Set color
id: random-color-generator
run: echo "SELECTED_COLOR=green" >> $GITHUB_OUTPUT
- name: Get color
run: echo "The selected color is ${{ steps.random-color-generator.outputs.SELECTED_COLOR }}"