Es wird häufig auch Wrapper oder Hüllenklasse genannt.
Problem:
- Man hat eine Klasse oder ein Interface welches nicht kompatibel mit der Vorhandenen Codebase oder dem angestrebten Aufbau ist
Lösung:
- Das Adapter Pattern
import 'package:flutter/material.dart'; | |
import 'package:permission_handler/permission_handler.dart'; | |
void navigate(BuildContext context) { | |
Navigator.push<void>( | |
context, | |
NativePageRoute( | |
onPush: () => openAppSetttings(), | |
onResume: () => Future.value(), | |
), |
import 'dart:developer'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:sentry/sentry.dart'; | |
class SentryBlocObserver extends BlocObserver { | |
SentryBlocObserver({Hub? hub}) : _hub = hub ?? HubAdapter(); | |
final Hub _hub; |
/// Requires at least Flutter 3.x | |
import 'dart:async'; | |
import 'dart:ui' as ui; | |
import 'package:flutter/foundation.dart'; | |
import 'package:dio/dio.dart'; | |
import 'package:flutter/widgets.dart'; | |
/// Fetches the given URL from the network, associating it with the given scale. | |
/// |
// Integration for http_link / GraphQL | |
// The following code can be used as | |
// final httpLink = HttpLink( | |
// appConfig.graphQL, | |
// httpClient: httpClient, | |
// useGETForQueries: true, | |
// serializer: SentryRequestSerializer(), | |
// httpResponseDecoder: sentryResponseDecoder, | |
// ); |
// add https://pub.dev/packages/stack_trace_parser to pubsepc.yaml | |
import 'dart:async'; | |
import 'package:flutter/services.dart'; | |
import 'package:package_info_plus/package_info_plus.dart'; | |
import 'package:sentry/sentry.dart'; | |
import 'package:stack_trace_parser/stack_trace_parser.dart'; | |
class PlatformExceptionEventProcessor implements EventProcessor { |
import 'dart:async'; | |
import 'package:flutter/services.dart'; | |
import 'package:package_info_plus/package_info_plus.dart'; | |
import 'package:sentry/sentry.dart'; | |
import 'package:stack_trace_parser/stack_trace_parser.dart'; | |
class PlatformExceptionEventProcessor implements EventProcessor { | |
final SentryOptions _options; | |
PackageInfo? _packageInfo; |
import 'dart:convert'; | |
void main() { | |
final dynamic smth = jsonDecode(''' | |
{ | |
"glossary": { | |
"title": "example glossary", | |
"GlossDiv": { | |
"title": "S", | |
"GlossList": { |
#include <HID-Project.h> | |
#include <HID-Settings.h> | |
/** | |
HIGH = 1 | |
LOW = 0 | |
*/ | |
#define PRESSED 1 | |
#define RELEASED 0 |
/* | |
* Copyright (C) 2014 [email protected] | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |