updateView method

  1. @override
Future<bool> updateView(
  1. String viewId,
  2. Map<String, dynamic> propPatches
)
override

Update properties for an existing view

Implementation

@override
Future<bool> updateView(
    String viewId, Map<String, dynamic> propPatches) async {
  // Track operation for batch updates if needed
  print("FINAL UPDATE GET CALLED");
  if (_batchUpdateInProgress) {
    _pendingBatchUpdates.add({
      'operation': 'updateView',
      'viewId': viewId,
      'props': propPatches,
    });
    return true;
  }

  try {
    // Process props for updates
    final processedProps = preprocessProps(propPatches);

    // Special case for text content updates to ensure they're always propagated
    if (propPatches.containsKey('content')) {
      if (kDebugMode) {
        print('Updating content for view $viewId: ${propPatches['content']}');
      }
    }

    // Make sure prop updates are properly queued even if many updates happen quickly
    final result = await bridgeChannel.invokeMethod<bool>('updateView', {
      'viewId': viewId,
      'props': processedProps,
    });

    if (result != true && kDebugMode) {
      print('Native updateView returned false for viewId: $viewId');
    }

    return result ?? false;
  } catch (e) {
    debugPrint('Method channel updateView error: $e');
    return false;
  }
}