Skip to content

Instantly share code, notes, and snippets.

View electricbolt's full-sized avatar

Electric Bolt electricbolt

View GitHub Profile
@electricbolt
electricbolt / objectivecffi.dart
Created May 31, 2022 22:32
Example of Flutter FFI extensions for calling Objective-C methods.
// ignore_for_file: non_constant_identifier_names
import 'dart:convert';
import 'dart:ffi';
import "package:ffi/ffi.dart";
/// # Get Objective-C singleton.
/// Pointer<Void> instance = objc_msgSend_object(objc_getClass('UIDevice'), 'currentDevice');
///
/// # Read String.
@electricbolt
electricbolt / FirebaseResourcesWrapper.java
Last active February 5, 2023 01:45
Subclass of android.content.res.Resources that is used to capture Firebase Analytics initialization process to return the "google_app_id" string that we require, programmatically, rather than it being embedded into strings.xml. See https://github.com/firebase/firebase-android-sdk/issues/66
package nz.co.electricbolt.firebase;
import android.content.res.AssetFileDescriptor;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Movie;
import android.graphics.Typeface;