Skip to content

Instantly share code, notes, and snippets.

View albertusdev's full-sized avatar

Albertus Angga Raharja albertusdev

View GitHub Profile
@albertusdev
albertusdev / base_network_service.dart
Last active May 25, 2020 14:04
Base code for CRUD usecases in Flutter
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:meta/meta.dart';
import 'errors.dart';
import 'models/base_model.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
beglitter
belitter
blitter
litter
liter
iter
ter
er
r
// Copyright (c) 2019, 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 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
// Copyright (c) 2019, 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 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
// Copyright (c) 2019, 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 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
import 'package:flutter/material.dart';
import 'package:learn_fazz/widgets/post_feed_card.dart';
class CoursePage extends StatefulWidget {
static String tag = '/course-page';
@override
_CoursePageState createState() => _CoursePageState();
}
directTrain(saarbruecken,dudweiler).
directTrain(forbach,saarbruecken).
directTrain(freyming,forbach).
directTrain(stAvold,freyming).
directTrain(fahlquemont,stAvold).
directTrain(metz,fahlquemont).
directTrain(nancy,metz).
direct(X, Y) :- directTrain(X, Y).
direct(X, Y) :- directTrain(Y, X).
group('User inputs valid form values', () {
const Duration delayedDuration = const Duration(milliseconds: 50);
setUp(() {
mockHttpClient = MockHttpClient();
when(mockHttpClient.post<Map<String, dynamic>>(any,
data: anyNamed('data')))
.thenAnswer((_) async {
await Future.delayed(delayedDuration);
return Future<Response<Map<String, dynamic>>>.value(
Future<void> chooseImageFromImagePicker(WidgetTester tester, {bool shouldConfirm = true}) async {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
log.add(methodCall);
return './assets/images/pattern-bg.png';
});
await tester.tap(find.byKey(const Key('addPhotoLabel')));
await tester.pump();
await tester.pumpAndSettle();
class MockHttpClient extends Mock implements Dio {}
void main() {
Dio mockHttpClient = MockHttpClient();
const MethodChannel channel =
MethodChannel('plugins.flutter.io/image_picker');
final List<MethodCall> log = <MethodCall>[];
}