this is flutter rsocket-dart code.
https://github.com/rsocket/rsocket-dart/blob/master/lib/route/reflection.dart
but, I cant't to use this library in flutter, because this package use 'dart:mirrors' packages.
So, I want to change this code.
but, I very very low level... I can't to understood this code...
import 'dart:mirrors';
import '../rsocket.dart';
import 'package:collection/collection.dart' show IterableExtension;
RSocketService? getRSocketServiceAnnotation(dynamic instance) {
final DeclarationMirror clazzDeclaration = reflectClass(instance.runtimeType);
final classMirror = reflectClass(RSocketService);
final annotationInstanceMirror =
clazzDeclaration.metadata.firstWhereOrNull((d) => d.type == classMirror);
if (annotationInstanceMirror == null) {
print('Annotation is not on this class');
return null;
}
return annotationInstanceMirror.reflectee as RSocketService?;
}
How can I change this code to not use mirror?
Aucun commentaire:
Enregistrer un commentaire