Skip to content

Instantly share code, notes, and snippets.

// Copyright 2019 the Dart project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
typedef GenMethod<T> = String Function(T value);
class CustomValue {
final String data1;
final String data2;
CustomValue(this.data1, this.data2);
}
typedef GenMethod<T> = String Function(T value);
class CustomValue {
final String data1;
final String data2;
CustomValue(this.data1, this.data2);
}
@matanshukry
matanshukry / main.dart
Created September 9, 2023 10:04
dart generic method
typedef GenMethod<T> = String Function(T value);
class CustomValue {
final String data1;
final String data2;
CustomValue(this.data1, this.data2);
}
/**
* Copyright (c) Matan Shukry
* All rights reserved.
*/
import { UrlSegment, UrlSegmentGroup, Route } from '@angular/router';
// export type UrlMatchResult = {
// consumed: UrlSegment[]; posParams?: { [name: string]: UrlSegment };
// };
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
//*********************************************
// APP entry point
//*********************************************
void main() => runApp(
const ProviderScope(child: App()),
);
@matanshukry
matanshukry / multipart_request_ex.dart
Created March 19, 2022 09:18
Extension to the Multipart Request that can use headers-per-field
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:convert';
import 'dart:math';
import 'package:http/http.dart';
final _newlineRegExp = RegExp(r'\r\n|\r|\n');
class MyData {
MyData({this.value});
final int? value;
String get valueText {
if (value == null) {
return "No Value";
}